← All games

Cache Eviction Lab

Predict cache hits and misses as requests flow through an LRU cache, then experiment with TTL behavior and stale data tradeoffs.

Concept
Cache hits, misses, LRU, TTL, and stale data
Difficulty
Beginner
Play time
5-8 minutes
Path
Data & Performance

Interactive scenario

Playable game area: Make the next backend decision

Use the controls below. Feedback appears immediately and final scores stay in this browser.

Concept notes

Why this decision matters

Cache Eviction Lab is focused practice for Cache hits, misses, LRU, TTL, and stale data. It explains why each answer is safe, risky, or production-ready.

Caching is a tradeoff between speed, capacity, and freshness. This lab makes those moving parts visible through a small request sequence.

Learning objectives

  • Predict cache hits and misses from a request sequence.
  • Visualize LRU eviction as cache capacity fills.
  • Understand how TTL changes freshness and hit rate.

How to play

  1. Read the cache scenario and its evidence about recent use, expiry, or capacity.
  2. Choose one strategy that best addresses the cache behavior described.
  3. Select Submit decision, read the explanation, then choose Next challenge or Finish run.
  4. The gauges illustrate the scenario; they do not measure live cache hits or misses.

Scoring

  • Your score ranges from 0 to 1000 and reflects the quality of your decisions.
  • Consistently strong decisions at harder difficulty levels earn an extra bonus.
  • Completing all eight decisions adds a completion bonus.
  • Response time does not affect your score. Take time to read the evidence and explanations.

Backend concept notes

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.

Common mistakes

  • Thinking cache capacity is unlimited.
  • Forgetting that reading an item updates its recency in LRU.
  • Using long TTLs for data that must be fresh.

Review misses from this game

Related Backend Study Lab tools

Use tools from the main site when you want to inspect real inputs.

FAQ

Short answers for how this game fits backend interview and study practice.

Why do caches return stale data?

Cached values can outlive the source update unless they are invalidated or expire through TTL.

Is a higher hit rate always better?

Not always. High hit rate is useful, but correctness and freshness matter too.

Leaderboard

Top 10 scores for the current ruleset. No account required.

Loading leaderboard...

    Finish the game to load your latest local score.