- What are the common patterns?
- Cache-aside, write-through, write-behind, refresh-ahead. Each has tradeoffs in consistency, complexity, and latency.
- Where should I cache?
- Browser, CDN, reverse proxy, application memory, or database. The page has a decision flowchart based on update frequency and consistency needs.
- How do I invalidate?
- The hard problem. TTL (time-based), event-driven (write triggers invalidation), or versioned cache keys (URL-level bust). Each trades off consistency vs complexity.
- Thundering herd — what is it?
- When cache expires and 1000 requests hit the origin simultaneously. Solutions: request coalescing, stale-while-revalidate, jittered TTLs.