Prerequisites
What it is
Write-through caching updates the cache and the database as part of the write path. The cache mirrors the source of truth for the data it stores.
Why it matters
It avoids many stale-read problems from cache-aside because recently written data is immediately present in the cache. This gives readers a simpler mental model.
How it works
On write, the application or cache layer writes the new value to the cache and persists it to the database before acknowledging success.
When to use it
Use it for read-heavy data where writes are less frequent and freshness matters, such as account settings, entitlement records, or durable configuration.
Tradeoffs / failure modes
Writes are slower because two systems are involved. Partial failure handling is tricky: if the database write fails after the cache write, the cache can lie.
Tiny example
Updating a user’s notification preference writes the new value to Redis and the preferences table before returning success.
Related guides and systems
See Caching Strategies, Google Drive, GitHub, and Slack.
Seen in deeper dives
Capability
Caching Strategies
Cache-aside, write-through, invalidation patterns, and distributed caching with Redis
Case Study
GitHub
The world's largest code hosting platform powered by Git at scale
Case Study
Google Drive
Cloud file storage and real-time collaboration at planetary scale
Case Study
Slack
Channel-based messaging for the enterprise workplace
Related concepts
Replication
Copy data across nodes to improve availability, read scale, and disaster recovery.
Strong Consistency
Make reads reflect the latest committed write for correctness-critical data.
Eventual Consistency
Allow replicas to temporarily disagree while guaranteeing they converge later.