Caching Strategies
Place caches where they cut latency and load, choose read and write strategies, and control staleness, stampedes and hot keys.
4 objectives 6 steps about 135 min
Learn it step by step
Read the lessons in order, try the practice checks, then prove the skill with the knowledge check.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Choose cache placement (HTTP client and CDN, reverse proxy, application, database) and a pattern (cache-aside, read-through, write-through, write-behind, refresh-ahead) for a read/write profile.
- Design invalidation, TTL and HTTP caching rules (Cache-Control, ETag revalidation) for API responses, and state the maximum staleness users can observe.
- Size a cache from working set and target hit ratio, and estimate the resulting load on the backing store.
- Prevent cache stampedes, hot-key overload and cache-induced inconsistency with techniques such as request coalescing, jittered TTLs and versioned writes.
Lesson plan
6 steps, about 135 min · 5 of 5 lessons available so far
- Cache layers, from HTTP caching to the database Concept · 20 min
- Cache-aside, read-through, write-through, write-behind and refresh-ahead Concept · 25 min
- Invalidation, TTLs, HTTP revalidation and the staleness budget Concept · 20 min
- Hit-ratio math and sizing a cache tier Worked example · 25 min
- Surviving stampedes and hot keys Lab · 30 min
- Caching check Knowledge check · 8 questions
Practise it
Add cache-aside caching to a read-heavy endpoint, measure hit ratio and p99 latency before and after, then trigger a stampede by expiring a hot key under load and fix it with request coalescing or early refresh.
Build it from scratch
Practice builds that exercise this skill by re-creating a real technology.
- Build your own DNS ServerIntermediate · 8–16 h
- Build your own URL ShortenerIntro · 4–8 h
- Build your own CDNAdvanced · 10–20 h
- Build your own RedisIntermediate · 15–30 h
References
Hard prerequisites
None.
Unlocks
On these roadmaps
Progress and evidence for this skill are shared across all of them.