Skip to main content

Write-Through Cache

What write-through cache means, why it helps keep cache aligned with writes, and where it costs you more latency.

Andrews Ribeiro

Andrews Ribeiro

Founder & Engineer

What it is

Write-through cache means the write updates the primary source and the cache in the same flow.

If the operation succeeds, the cached copy is already aligned with the new value.

When it matters

This matters when stale reads immediately after a write are especially painful.

You trade more work on the write path for a smaller chance of serving old data afterward.

Common mistake

The classic mistake is treating write-through as “free cache.”

It is not.

It adds latency and dependencies right in the write path.

Short example

A product price changes.

The application writes to the database and, before considering the operation done, also updates that product key in cache.

That way, the next read already sees the new value.

Why it helps

Write-through helps when the priority is keeping reads aligned right after a write.

But it only makes sense when the write path can afford that extra cost.

Write-through buys fresher cache by making the write path more expensive.

You finished this article

Keep exploring

Related articles