springspring-bootredisjedis

Do i need Jedis to use Redis cache in Spring boot


I am new to Redis and want to implement Redis Cache in my Spring Boot application. I have gone through few blogs and saw some using Jedis the java client for Redis while few using just spring-boot-starter-data-redis

Should I use Jedis when working with Production ready applications. What problems it solves over just spring-boot-starter-data-redis?

I tried with spring-boot-starter-data-redis and caching is working with Spring annotations like @Cacheable, @CacheEvict but I need to understand should I be using Jedis and then create Redis Template and Redis Connection Factory and all these stuff for caching


Solution

  • To have a better understanding of Spring Cache and Redis, it's important to grasp the core components separately, this is a short overview of Jedis, spring-data-redis, and Spring Redis Cache

    In summary, when working with Spring Cache and Redis you should provide a Redis driver implementation (Jedis, Lettuce) to spring-redis-data, but you can use either high-level API (for cache are @Cacheable, @CacheEvict, and for spring-redis-data RedisTemplate) or a low-level like Jedis, depends on the use cases you have