Commit 4ee93ff
authored
fix(redis-strings): prevent mapping tables deletion before cache purge (#3)
This PR addresses a critical data consistency issue in the delete method where
mapping table entries could be removed before the cache was successfully cleared.
By reversing the operation order to clear cache after mapping tables are updated,
we ensure that even in failure scenarios, the cache can still be revalidated
through tags.
Previously, concurrent operations in Promise.all could lead to orphaned cache
entries with no way to revalidate them via tags, potentially serving stale data
indefinitely. This change provides a more robust cache invalidation strategy
that prioritizes data consistency over performance.1 parent ce977bd commit 4ee93ff
File tree
2 files changed
+40
-38
lines changed- packages/nextjs-cache-handler
- src/handlers
2 files changed
+40
-38
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
Lines changed: 39 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | 123 | | |
125 | 124 | | |
126 | 125 | | |
| |||
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
165 | 169 | | |
166 | 170 | | |
167 | 171 | | |
| |||
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | 187 | | |
189 | | - | |
190 | 188 | | |
191 | 189 | | |
192 | 190 | | |
| |||
251 | 249 | | |
252 | 250 | | |
253 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
254 | 276 | | |
255 | 277 | | |
256 | 278 | | |
| |||
284 | 306 | | |
285 | 307 | | |
286 | 308 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
312 | 313 | | |
313 | 314 | | |
314 | 315 | | |
| |||
329 | 330 | | |
330 | 331 | | |
331 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
332 | 338 | | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | 339 | | |
338 | 340 | | |
339 | 341 | | |
| |||
0 commit comments