Caching · Key takeaways
1 min readRapid overview
Key takeaways
- Every caching question is a staleness-tolerance question. Answer that first.
- Content-hashed URLs make invalidation unnecessary; the HTML entry point must stay
no-cache. - Cache-aside is the default; write-through when reads reliably follow writes; write-behind only where losing writes is acceptable.
- Stampede fixes compose: single-flight, TTL jitter, and serve-stale-while-revalidating.
- Hot keys are immune to cluster scaling. Use a short-lived local cache or split the key.
- TTL is the bound on how wrong you may be, so it is chosen from business tolerance.
- On write, delete the entry rather than updating it, unless you can guarantee ordering.