← Lessons

quiz vs the machine

Gold1390

System Design

Caching Layers Cascade

Stacking caches from client to database so each layer absorbs load before it reaches the next.

4 min read · core · beat Gold to climb

The layered view

A request can pass through several caches before reaching the database. Each layer that hits returns early, sparing everything behind it. This cascade is how big systems keep databases lightly loaded.

The common layers

  • The browser or client cache avoids a network call entirely.
  • The CDN serves static and cacheable content near the user.
  • An application cache like Redis holds hot objects and query results.
  • The database is the final fallback, the source of truth.

Why order matters

A hit at an outer layer is cheaper and faster than a hit deeper in.

  • High hit ratios at the edge cut both latency and origin load.
  • A miss simply falls through to the next layer, then backfills on the way out.

The risk is stale data at any layer, so each needs a clear expiry and invalidation rule.

Key idea

Stack caches so each layer absorbs requests and only true misses reach the database.

Check yourself

Answer to earn rating on the learn ladder.

1. What happens on a cache miss in the cascade?

2. Why is an outer cache hit preferred?