In a write-through approach, the application uses the cache as the main data store. In other words:
- Application adds a new entry or updates an existing entry in a cache.
- The cache writes the entry to the data store e.g., a DB.
- The new/updated data is returned to the application for immediate access.
Disadvantages of write-through
- Extended latency from write operations due to having to write to the cache, and then also to the database.
- If the cache fails and a new instance is spun up, entries won’t be cached until data has been updated. Using Cache-Aside in conjunction with write operations can mitigate this.
- Most data that has been written might not be read again. This can be minimized with a short TTL.