Cache
Now we are pretty much in the driver's seat of our microservice development. We have developed microservices, connected them via a gateway, and set up a communication layer between them. Since we have distributed our code into various services, one of the problems that may arise is accessing the much-needed data at the right time. Using in-memory has its own set of challenges that we never want to introduce (for example, you need to introduce load balancers, session replicators, and so on). We need some way to access temporary data across services. This would be our caching mechanism: one service creates and stores data in cache, while others may use it on need and situation basis or fail basis. This is where we will introduce Redis as our cache database. Prominent caching solutions include Redis and Hazelcast.
Blessing and curse of caching
Whenever we are told to optimize the performance aspects of our application, the first thing that comes to mind is caching. Caching can be defined...