Module · Backend Engineer
Caching & Performance
The fastest request is the one you never make - if the cache stays correct.
TOPIC 01
Cache Strategies
Read-through, write-around and the stampede you get when a hot key expires.
What you'll practice
- Choose a Read-Through Policy — guided · beginner
- Defend Against a Cache Stampede — practice · intermediate
A command you'll meet
cat ~/backend/cache/policy.yamlA cache without a TTL is a bug waiting for a bad day. Open the task below for the full walkthrough.
Hands-On Tasks in This Topic (2)
Choose a Read-Through Policy
A read-through cache keeps the calling code simple - it asks the cache and the cache knows how to load. Write the policy.
Defend Against a Cache Stampede
When a hot key expires, a thousand requests hit the database at once. Write the defence - a single flight, a short lock and a little jitter.
TOPIC 02
Invalidation & Measurement
How a cached value is thrown away, and how you know the cache is worth keeping.
What you'll practice
- Invalidate from Events, Not from Code — practice · intermediate
- Measure the Hit Ratio — challenge · advanced
A command you'll meet
cat ~/backend/cache/metrics.mdIf you cannot measure the cache, you cannot argue for it. Open the task below for the full walkthrough.
Hands-On Tasks in This Topic (2)
Invalidate from Events, Not from Code
Time based expiry is a guess. Write the event driven invalidation that drops the entry the moment the data changes.
Measure the Hit Ratio
A cache earns its keep with a hit ratio and a latency budget. Write the measurement plan and the objective you will hold it to.