Caching
Caching capstone: free-recall review
Retrieval beats re-reading. For each prompt, say or write a full answer from memory before you open the model answer — the effort of recall across the whole track is what fuses the separate units into one design instinct.
Reconstruct the track’s spine — layer ownership, the TTL-cascade rule, stampede vs dogpile defences, validators vs freshness, SWR vs stale-if-error, and write-path invalidation — without looking back at the lessons.
- 01Name the four caching layers a byte may pass through and the data each one should own.
- 02State the TTL-cascade rule and explain the bug it prevents.
- 03Distinguish a stampede from a dogpile, and give the defence for each.
- 04When do you reach for a validator (ETag/Last-Modified) versus a freshness directive (max-age/s-maxage)?
- 05Contrast stale-while-revalidate with stale-if-error and explain why a robust stack uses both.
- 06Why does invalidation belong on the write path, and what is the correct propagation order?
If you reconstructed each answer from memory, you hold the track’s spine as one design: assign each layer its owned data, shrink freshness outward (or purge the outer layer on every inner change), defend a hot-key expiry with single-flight plus SWR, use freshness directives to skip the request and validators to make the unavoidable revalidation a cheap 304, layer stale-while-revalidate for the happy path with stale-if-error for outages, and wire invalidation into the write path so it propagates Redis → proxy → CDN in order. The capstone skill is composing these into a strategy that holds under real traffic — not memorising any one directive.