Caching 101
Rajika Imal
Posted on September 22, 2020
Caching is one of the most used techniques to improve application performance. There are few means of managing caches based on the application use cases. An example of a cache is in-memory storage sitting in between an application server and a database.
Read through cache
When a record is read from the application, it looks in the cache before requesting from the persistence store (database). If the data is present, it will return the result avoiding the round trip to the database.
Write through cache
An operation that adds new data to an application adds records to the database. Before adding the data, the write-through cache is updated and then the database is updated. This way the cache is up to date with the new records.
Write behind cache
In this case, the cache is updated asynchronously after writing data to the database. The time which takes to update the cache can be configured.
Refresh ahead cache
Caches have invalidation periods, meaning data can be expired after a certain defined period of time. With refresh-ahead, the cache can be reloaded to load new data so that the cache is updated with the recently accessed data before invalidating data.
Posted on September 22, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.