System Design Patterns: From Fundamentals to Real Systems
Vote

0% completed

Write-Through

1. The Pattern

Writes go through the cache. The cache writes to the database synchronously, meaning the caller waits for that write. The caller is not told "done" until both the copy and the original are updated. The cache is never stale for data written this way, because it was part of the write.

The previous two lessons left writes as your chore. You had to delete the key on write, and keep a TTL as insurance. A TTL is a time-to-live, so an entry expires on its own. Write-through makes that chore structural

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%