Intermediate
Redis and Caching
Fast, until it is wrong.
Cache-aside and its invalidation, TTLs, stampedes, Redis data structures and their uses, distributed locks and their limits, and Spring's cache abstraction — with the consistency bugs caching introduces named up front.
4 lessons written2 modules~1h reading
After this course you can
- Choose a caching pattern and an invalidation strategy for a read path
- Prevent a cache stampede and explain the thundering herd
- Use Redis structures beyond GET and SET: hashes, sorted sets, streams
- Explain why a Redis lock is not a correctness guarantee
Curriculum
4 lessons · outlined lessons show their plan01
Caching patternsA 2.6 ms query, a 75 µs Redis GET and a 5 ns local map; cache-aside and its relatives, local against distributed, TTLs, LFU beating LRU at one tenth of the data, and negative caching.13 minStampedes and consistency200 requests running the same query when a hot key expired, single-flight and rebuild locks, serving stale for a 2 ms p99, the delete-on-write race versioning closes, and hot keys.13 minCaching
02
Redis data structuresGET-then-SET losing 72% of increments, listpack encodings, sorted-set leaderboards and a rate limiter in Lua, streams recovering a crashed worker's entry, and HyperLogLog in 14 KB.14 minDistributed locks and their limitsA pause longer than the lock: two holders, a deleted lock, a stale write as the final state — fencing tokens refusing it, the Redlock debate, and designs that need no lock.13 min