Write-through
Last updated
Write-through?
The application uses the cache as the main data store, reading and writing data to it, while the cache is responsible for reading and writing to the database:
- Application adds/updates entry in cache
- Cache synchronously writes entry to data store
- Return
Application code:
set_user(12345, {"foo": "bar"})
Cache code:
def set_user(user_id, values):
user = db.query("UPDATE Users WHERE id = {0}", user_id, values)
cache.set(user_id, user)
Write-through is a slow overall operation due to the write operation, but subsequent reads of just written data are fast. Users are generally more tolerant of latency when updating data than reading data. Data in the cache is not stale.
Disadvantages
- When a new node is created due to failure or scaling, the new node will not cache entries until the entry is updated in the database. Cache-aside in conjunction with write through can mitigate this issue.
- Most data written might never be read, which can be minimized with a TTL.

Free resources to learn Write-through
More in stage 14: Asynchronism
Write-through: common questions
Can I learn Write-through in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Write-through in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Write-through tutorial for beginners?
It is lesson 51 of 147 in the free System Design roadmap, in stage 14, Asynchronism. If you are new to System Design, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.