Self-test
Check your understanding
Self-test12 questions
Walk through a cache-aside read and write. Why prefer deleting the cache key over setting the new value on write?
Describe the race that can leave a stale value in the cache even with delete-on-write. What bounds it?
What's a cache stampede? Give three defences.
What's cache penetration, and how do you stop it?
Why does a fixed-window rate limiter allow up to twice the limit? Which algorithm fixes it most cheaply?
Why must a token bucket's refill-and-take run as a Lua script?
Should a rate limiter fail open or fail closed when Redis is down? Give a case for each.
Why is
DELthe wrong way to release a lock? What's the right way?What problem do fencing tokens solve that a perfect lock release doesn't?
Summarise the Redlock debate. When is a single-instance Redis lock good enough?
Why use
GETDELwhen flushing counters to a database?- Design question
Design the Redis side of a URL shortener: redirects cached, per-user rate limits on creating links, real-time click counts, and daily unique visitors per link.