Write-Through Pattern 00:00:01 A saved name should appear on the next device A customer changes a profile name, then opens the profile on a different phone. The write-through design updates the cache on the write path. Track what is durable before returning success. The app is asked to change user:123 from John Doe to Jane Doe. The app hands the save to the cache layer. The cache layer passes the same write on, in the same request. The row is committed. Somebody asks for user:123. The value was put there by the write, so even the first read is fast. The first read can be fast because the write populated the copy. The exact consistency guarantee still depends on how failures and concurrent writers are handled. 00:00:45 The copy changes and the database refuses Pause between the two writes and make persistence fail. The cache may now contain a name that the database never accepted. Examine both the response and the repair action. Step one worked. The write times out or breaks a rule. Between failure and undo a reader can see Jane Doe, which was never saved. The key is deleted and the caller gets an error. A miss loads John Doe again. Both agree. Rollback or invalidate only with the necessary version protection. A delayed cleanup must not erase a newer successful edit made by another request. 00:01:26 Reverse the write order Let the database commit the new profile before the cache update begins. Now a cache failure leaves an old copy of a real saved change, rather than a copy of an uncommitted change. The database is written first. The cache gets the same value. Nothing has been changed in the cache. There is nothing to undo. The save is real. The copy is old until the retry or the TTL. Choose what success means for this policy and make repair observable. A durable save and immediate visibility in every copy are distinct commitments. 00:02:01 The older writer finishes last Two users update the same record in order at the database. Their cache messages travel by different routes. The second committed value can arrive in cache before the first one's delayed message. The database gets 11 and then 12. The truth is 12. B is faster and stores 12. A overwrites it with 11. A's write carries version 1 and Redis already has version 2, so it is refused. Compare authoritative versions at the point of installing a copy. Arrival order at the cache alone does not reproduce the database commit order. 00:02:38 A replacement node begins with no names After a cache node fails, yesterday's write-through updates did not automatically populate its empty replacement. Follow the first read of an existing profile on that new machine. A cache node failed. Its replacement is empty. Values saved last week are not in the cache until someone saves them again. On a miss, load from the database and fill. That is why write-through is paired with cache-aside or read-through. Pair the write path with a defined miss policy and protect the origin from a cold rebuild. The customer then has a recovery story as well as a fast normal save.