Concept explanation
Caching is a tradeoff between speed, capacity, and freshness. This lab makes those moving parts visible through a small request sequence.
Predict cache hits and misses as requests flow through an LRU cache, then experiment with TTL behavior and stale data tradeoffs.
practice/cache-eviction-lab Cache prediction score Play, get feedback, save local progress, and optionally submit a leaderboard score.
Caching is a tradeoff between speed, capacity, and freshness. This lab makes those moving parts visible through a small request sequence.
Use the controls below. Feedback appears immediately, and final scores are stored locally.
Top 10 submitted scores. No account required.
Loading leaderboard...
Finish the game to load your latest local score.
A cache hit avoids slower work, such as database reads or remote API calls. A miss repopulates the cache and may evict another item.
LRU evicts the least recently used item. TTL expires items based on age, which can protect freshness but reduce hit rate.
Short answers for how this game fits backend interview and study practice.
Cached values can outlive the source update unless they are invalidated or expire through TTL.
Not always. High hit rate is useful, but correctness and freshness matter too.