Build Redis-Style Key Expiry

lazy plus sampled active expiry

Challenge 3 of Storage & CachingIntermediate~50 min

Expire keys proactively. Build lazy expiry on read, then a Redis-style active sweeper that randomly samples keys with a TTL, instead of a timer per key, and bound its work so it never blocks.

5 steps

  1. 1Lazy Expiry on Read
  2. 2Inspect TTL and Track Volatile Keys
  3. 3Sample and Expire a Batch
  4. 4The Active-Expiry Cycle
  5. 5Bound the Work So It Never Blocks
Start step 1