Caching

Caching is essential in order to build a performant application. You would not want to hit the external service or the database all the time. Data that does not change frequently can be cached.

Spring provides transparent mechanisms to connect and use a Cache. The following steps are involved in enabling a cache on an application:

  1. Add the Spring Boot Starter Cache dependency.
  2. Add caching annotations.

Let's discuss these in detail.

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.