Caching for Microservices

Saurav Kumar
11 min readNov 17, 2023

What is Caching?

Caching is a technique used in computer science and software development to temporarily store copies of frequently accessed or computationally expensive data in order to reduce the time or resources required to fetch the data again. The primary purpose of caching is to improve the performance and efficiency of a system by providing quicker access to data.

In a caching system, there is a cache — a high-speed storage layer — that sits between the data source (e.g., a database, a web service, or an API) and the application that needs the data. When the application requests data, the caching system first checks if the data is already in the cache. If the data is present, it can be retrieved more quickly than fetching it from the original source. If the data is not in the cache, the system fetches it from the source and stores a copy in the cache for future use.

Caching mechanisms commonly used in various architectures

1. Embedded Cache:

In an embedded cache, caching functionality is integrated directly within the application or service, rather than relying on an external caching layer or system. The cache is part of the application’s runtime environment, providing an in-memory storage space for frequently accessed data. This…

--

--

Saurav Kumar
Saurav Kumar

Written by Saurav Kumar

Experienced Software Engineer adept in Java, Spring Boot, Microservices, Kafka & Azure.

Responses (4)