Caching strategies
Keywords: [[Cache]], [[Caching]]
Cache Aside
If data exists in cache, application reads data from cache.
If not
Application reads data from database
Application updates data to cache.
Read Through
If data exists in cache, application read data from cache.
If not
Cache reads data from database
Cache returns data to application
Write Through
Application writes data to cache.
Cache writes data to database immediately.
Write Back a.k.a Write Behind
Application writes data to cache constantly.
Cache writes data to database once in a while.
Write Around
With Cache Aside
Application writes data to database.
If data exists in cache, application reads data from cache.
If not
Application reads data from database
Application updates data to cache.
With Read Through
Application writes data to database only.
If data exists in cache, application read data from cache.
If not
Cache reads data from database
Cache returns data to application
Last updated