Write-through
medium 22 minWith write-through, a save goes to the cache and to the database in the same request, and the caller hears success only when both are done.
Where it shows up
The same pattern appears across everyday software.
Amazon DynamoDB Accelerator
DAX is a write-through cache for DynamoDB. A write goes to the table first, then to the item cache, and is copied to the other cache nodes a moment later. The documentation says readers on different nodes can briefly see different values.
Facebook TAO
The 2013 paper explains that all writes to a shard go through its leader cache, which keeps them in order. Follower caches are told about changes afterwards.
Ehcache
The Java cache can be given a loader and writer. Each put is then written to the system of record as part of the call.
Settings page
Someone switches to dark mode and the page reloads. The save put the new value into the cache, so the page shows it without a query.
Shopping cart
Each change is saved to the database and to the cache, because the next page view reads it again.
Session store
Sessions are kept in a fast store for each request and written to the database as well, so that a cache restart does not sign everybody out.