Cache-Aside vs Write-Through — who owns the cache-fill and write-persist
Caching & Data Freshness • Sensei Learning System

Cache-Aside vs Write-Through: Who Owns Cache Population

The ownership question nobody asks until the cache and the database drift apart: which component holds the fill and write logic?

Core Concept

Cache population is not a single policy — it is two separate paths, and each path can be owned by a different actor.

Cache-Aside (lazy loading): the application owns the read path. On a miss, the app fetches from the database, writes the entry into the cache itself, then returns it. The cache stays a passive key-value store that knows nothing about the database.

Write-Through: the cache owns the write path. The app writes to the cache, and the cache synchronously persists to the backing store before it acknowledges — one logical update.

Key Components

Read path

Cache-Aside

App fetches from the DB on a miss and fills the cache itself. Resilient: a cache outage degrades to slow-but-correct. Only caches what is actually requested.

Write path

Write-Through

Cache persists to the DB synchronously before acknowledging. Keeps the cache warm and consistent on writes, centralises the logic, but pays DB latency on every write.

Read path

Read-Through

The true read-path counterpart of write-through: the cache itself fetches from the DB on a miss, and the application never sees the fill at all.

Write path

Write-Behind

Write-back: acknowledge first, persist asynchronously. Faster, but can lose acknowledged writes if the cache dies before the flush lands.

The Axis Correction

They are not opposites. Framing cache-aside vs write-through as a single dichotomy invites a false either/or.

Read-path policy

Cache-Aside / Read-Through — who fetches and fills on a miss?

Write-path policy

Write-Through / Write-Behind — who persists to the store?

These describe different axes. Production systems routinely run cache-aside reads together with write-through writes — the app owns the fill, the cache owns the persist.

How It Works

  1. Read miss, cache-aside: app checks the cache → miss → app queries the DB → app writes the row into the cache → returns it. The cache never touched the database.
  2. Write, write-through: app writes to the cache → cache blocks until it has written the same value to the DB → only then acknowledges the app.
  3. The guarantee boundary: “synchronously” means the cache waits for the store — it does not mean the pair is atomic. There is no distributed transaction: the DB write can succeed while the cache ack is lost, or the process can die between the two. It reduces divergence without eliminating it.

How to Falsify It

Checkpoint — answer before you move on

Q1

In cache-aside, who writes the entry into the cache on a read miss — and what does that make the cache itself?

Think: does the cache know the database exists?

Q2

Why are cache-aside and write-through not opposites? Name the true read-path counterpart of write-through.

One is a read-path policy, the other a write-path policy.

Q3

In write-through, “synchronously” means the cache waits for the store. Does that make the cache + database pair atomic? What can still go wrong?

There is no distributed transaction.

Hafs Ibrahim
Caching & Data Freshness • Sensei Learning System
© 2026 Hafs Ibrahim. All rights reserved.