Please enable JavaScript.
Coggle requires JavaScript to display documents.
Caching Strategies - Coggle Diagram
Caching Strategies
Read Through
-
When there is a cache miss, loads data from DB, populates cache and returns to application
-
-
-
Write Back/Behind
Application writes to cache which acknowledges immediately and after some delay writes back to the DB
-
When combined with read-through, good for mixed workloads where most recently updated and accessed data is always available in cache
-
If there is a cache failure, data may be lost
Cache Aside
-
The application first checks the cache, if there is a hit, returns data. If there is a miss, reads data from DB and returns it. Stores data in cache. Note that the application is responsible for fetching data from the DB and populating the cache
-
Resilient to cache failures. Data model stored in cache can be different from data model stored in DB
Write Through
-
-
On their own, introduce latency since there is an extra write but when paired with read through cache, support heavy read workloads and also guarantee data consistency
Write Around
-
Write around when combined with read through works for use cases where data is written once and read less frequently or never. For e.g. real time logs or chat messages