Building Blocks

Write-Through

Write-through caching writes to cache and database synchronously. Strong consistency, simpler reads, slower writes — when to use it.

2 min readConcepts · System Design

What is Write-Through?

Write-Through is a caching pattern where writes go to both the cache and the database synchronously. The cache acts as the main interface for both reads and writes.


How It Works

Both cache and database are updated before returning success.


Read Flow


Advantages

BenefitDescription
Cache always consistentWrites update cache immediately
No stale dataCache reflects DB state
Simple readsAlways read from cache
Data durabilityDB always has latest

Disadvantages

DrawbackDescription
Higher write latencyMust write to both
Cache may have unused dataWrites cached even if never read
Write amplificationEvery write hits DB and cache

Use Cases

Good for:

  • Data that's frequently read after write
  • Strong consistency requirements
  • Applications where write latency is acceptable

Not ideal for:

  • Write-heavy workloads
  • Data rarely read after write
  • Latency-sensitive writes

Comparison

AspectWrite-ThroughCache-Aside
Write latencyHigherLower
Cache consistencyAlways consistentMay be stale briefly
Cache populationOn every writeOn read (lazy)
ComplexityCache handles writesApp manages both

Interview Tips

  • Explain synchronous write to both cache and DB
  • Discuss latency trade-off vs consistency benefit
  • Compare with write-behind (async) pattern
  • Mention when write-through is appropriate

Finished reading?

Mark it done to track your progress in Concepts.