RECAP
What to remember
- A cache hit protects the store; the speed-up is a bonus.
- On a miss the service reads the store and fills the cache, so a cold or expired hot key can send a burst of misses to the store.
- Any change to the source of truth leaves cached copies stale until they expire or are purged.
- The TTL is the worst-case staleness. Write first, then purge, and keep the TTL as the safety net.
- For answers that must never be served (a takedown), check a small list on every request rather than trusting every cache to be purged.
NOW CLOSE THE GUIDE AND REDRAW IT
From memory, draw the read path for a short-link redirect with a cache. Then explain, on the same page, what happens when a cached redirect needs to change: once for an ordinary edit and once for an urgent takedown.
Check your drawing against this list afterwards, not before:
- Browser, redirect service, cache and alias store, with the cache checked first.
- The miss path: read the store, fill the cache, answer.
- A TTL written next to the cache and named as the worst-case staleness.
- The edit order: write the store, then purge the cache.
- A disabled list checked on every request, including cache hits.
- A note on why the redirect is a 302, not a 301.
APPLY IT
Sketch a URL shortener
GO DEEPER WITH OUR GUIDES
OFF-SITE SOURCES · NOT WRITTEN BY US
Sources and further reading
- RFC 9111: HTTP Caching
The rules for how HTTP caches decide freshness, expiry and reuse. Read the sections on freshness and on which status codes are cacheable by default.
- HTTP caching
A readable guide to browser and shared caches, Cache-Control and why fresh vs stale matters.
- Caching challenges and strategies
Lessons from running caches in production: cold starts, stale data, negative caching and what happens to the store when the cache disappears.
- Purge cache
A concrete example of explicit invalidation at an edge: purging by URL, tag or everything, and the limits that come with it.