/Spring-Caching

A small example of using Redis caching with Spring

Primary LanguageJava

Spring Caching

A small example of using Redis caching with Spring. It was developed as part of a Medium article found here. An outline of the system can be found below. It is written in Spring Boot, using H2 and Spring Data Redis, with a Redis instance running locally.

image

The application demonstrates two methods of caching:

  • Lazy Loading: When we retrieve a user from the database they are also written to the cache.
  • Write Through: When we write a user to the database they are also written to the cache.