The ownership question nobody asks until the cache and the database drift apart: which component holds the fill and write logic?
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.
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.
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.
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-back: acknowledge first, persist asynchronously. Faster, but can lose acknowledged writes if the cache dies before the flush lands.
They are not opposites. Framing cache-aside vs write-through as a single dichotomy invites a false either/or.
Cache-Aside / Read-Through — who fetches and fills on a miss?
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.
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?
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.
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.