awesome-everything RU
↑ Back to the climb

Caching

Cache invalidation: multiple-choice review

Crux Multiple-choice synthesis across cache invalidation — TTL jitter, the set-after-delete race, dual-write, delete vs update, and which write strategy preserves read-your-writes.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at senior altitude — in orbit
◷ 13 min

Six questions that cut across the whole unit. Each one is a decision you make in a real incident — not a strategy to name, but a staleness gap to weigh against what your product can tolerate.

Goal

Confirm you can connect TTL stampedes, the dual-write problem, the set-after-delete race, and the write-path strategies — the synthesis the lesson built toward: every strategy ships a different staleness.

Quiz

1,000 app servers cache the same hot key with an identical 300s TTL, all warmed in one deploy. At T=300 the origin gets hammered for ~100ms. What is the cleanest first fix, and why does it work?

Quiz

You use cache-aside with delete-on-write: update the DB, then DEL the key. A user reports their profile edit reverting for hours. What is the most likely root cause?

Quiz

Why is deleting the cache key on write the senior reflex, rather than updating it with the new value?

Quiz

Your team actively invalidates on every write and proposes removing the TTL entirely 'since we always purge.' What breaks?

Quiz

A user edits their own profile and must immediately see the new value (read-your-writes required). Which write strategy holds with the least racing risk?

Quiz

A hot key under cache-aside keeps hitting the set-after-delete race on every profile edit. You want the strongest fix that also reduces origin load. What do you reach for?

Recap

The through-line is one sentence: invalidation is choosing which staleness you ship. TTL is the cheap floor — bounded but prone to synchronized stampedes you defuse with jitter. Event-driven purge cuts staleness to the write but is a dual-write, so you keep a TTL as the backstop for every missed DEL. Delete beats update because it is idempotent and order-independent, but it still races with a concurrent reader — the set-after-delete race — closed by delayed double-delete, by leases (which also slashed Facebook’s hot-key load), or by funneling writes through the cache. And the write strategy you pick is a read-your-writes decision: write-through holds it, write-around breaks it, write-behind risks durability.

Continue the climb ↑Cache invalidation: free-recall review
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.