Ch. 19 · System Design

System Design Cache-Aside and Stale Data

System Design Cache-Aside and Stale Data. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readbeginnerupdated Oct 3, 2026

Cache-aside reads the cache, loads misses from an authoritative store and populates the cache. Invalidation and race behavior remain design obligations.

Before you start

You should understand API requests, storage and basic capacity estimates. Begin with a concrete user action and its correctness requirement. Draw data flow and failure boundaries before selecting infrastructure; a technology name by itself does not explain why a design meets the requirement.

The practical goal is to reason through this situation: A product detail read caches a value with a bounded lifetime. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: Identify the authority

The database owns the value; cache entries are replaceable copies.

Step 2: Trace hit and miss

Load misses from the authority and populate under a defined lifetime.

Step 3: Model write races

Invalidation and refill can interleave and restore stale values.

Worked scenario

A product detail read caches a value with a bounded lifetime.

Reader A misses and reads the old product. Writer B commits a new value and invalidates the cache. A then populates its older value after that invalidation. Simple cache-aside does not eliminate this race; choose acceptable staleness and a strategy matching the required guarantee.

Common mistake

Updating the database and cache separately can leave stale values if one step fails.

Verify the behavior

Force that interleaving and measure the stale interval under the chosen policy.

Interview exercise

Choose an invalidation policy.

Answer and reasoning

Define acceptable staleness, ownership and failure behavior, then test concurrent reads and writes rather than only cache hits.

Continue learning

Compare the scenario with the System Design interview questions and test your understanding with the System Design MCQs. For terminology and implementation details, consult the reference material.

More in System Design

read ✓System Design · hard

System Design: Bloom Filters

Use a Bloom filter to skip lookups with a tiny memory footprint, and understand its false-positive-only guarantee.

~2 min readread →
esc