RecapDifficulty: Advanced1 min

Recap: Caching

Cache-aside, three ways to invalidate, LRU, Bloom filters and two ways a cache takes a system down.

  • A cache keeps copies of frequent reads in memory, trading freshness for speed, and is judged by its hit rate (Caching: Keeping Frequent Reads Close).
  • Cache-aside: look, fetch on a miss, store, return; the store is what makes the next read a hit (Cache-Aside Example: A Product Page).
  • Invalidation by TTL allows staleness up to the TTL; delete on write and write-through keep copies fresh at the cost of touching every write (Cache Invalidation).
  • LRU evicts the item unread for longest, not the oldest (LRU Eviction).
  • A cache with no size limit is a slow memory leak (Unbounded Caches and the Slow Memory Leak).
  • A Bloom filter's "absent" is certain, and its "present" is only probable; it stops lookups for keys that do not exist (Bloom Filters).
  • A stampede is every request rebuilding a popular key at once; let one rebuild and the rest wait or read the old value (Cache Stampede).