Sometimes known as lazy-loading or cache-aside. This method is quite popular as it’s quite easy to implement without making loads of changes.

The flow of it is as follows:

  1. Client makes a request to read data
  2. Server checks if data exists in a cache
  3. When data exists in a cache, data is being returned
  4. If data do not exist in a cache, data is being fetched from a database
  5. data is being updated in a cache
  6. Data is being returned to a user

Transclude of Write-around-cache.excalidraw

Advantages

  • Your cache stays slim because it only contains data that it needs
  • Easy to implement and you get immediate gains

Disadvantages

  • Cache is filled only after a cache miss, which means that you need to do 3 trips (Client Server cache Server Database Server Cache Server Client)