Caching
A cache is a small, fast store that keeps copies of data that is slow to get, so that repeated requests are answered quickly. Almost every design answer adds one, so interviewers push on how data gets in, how it gets out, how it stays correct, and what happens when the cache is gone.
After this section you can name the usual write and read patterns, compare LRU and LFU eviction, explain a cache stampede (many requests refilling one entry at once), and say why a service should not depend on its cache to stay alive.
Topics in this section
- Why cache, and when not to
- Cache-aside and read-through
- Write-through, write-behind and refresh-ahead
- Eviction: LRU and LFU
- Expiry and stale data
- Stampede, cold caches and cache addiction