Advanced Caching Concepts

Learn about what caching strategies are and when to use them.

Introduction

Caching is a technique that helps in improving the performance of applications by reducing the number of requests that are made to an external system. We have already explored the basics of this concept as well as implemented in-memory caches. In this lesson, we will be discussing strategies for how and when to cache, specifically write-through, write-back, and write-around.

Write-through caching

Write-through caching is a caching strategy in which every write operation is written both to the cache and the underlying storage. This ensures that the data in the cache is always consistent with the data in the storage. When a read request is made, the cache is checked first. If the data is not in the cache, it is retrieved from the underlying storage, added to the cache, and then returned to the application, once again ensuring that the cache is up to date.

Get hands-on with 1400+ tech skills courses.