Questions tagged [spring-data-redis]

Spring Data Redis, part of the larger Spring Data family, provides easy configuration and access to Redis from Spring applications. It offers both low-level and high-level abstractions for interacting with the store, freeing the user from infrastructural concerns.

Spring Data Redis, part of the larger Spring Data family, provides easy configuration and access to Redis from Spring applications. It offers both low-level and high-level abstractions for interacting with the store, freeing the user from infrastructural concerns.

Features

  • Abstraction across multiple Redis drivers/connectors such as Lettuce and Jedis.
  • JDK, String, JSON and Spring Object/XML mapping serializers.
  • Spring cache abstraction for use with Redis.
  • JDK Collection implementation on top of Redis.
  • Pub/Sub integration.
  • Reactive and imperative APIs.

Online Resources:

Version History

1029 questions
12
votes
1 answer

Redis: Set different time to live for methods annotated with @Cacheable

I have a set of cached methods that look somewhat like this: @Cacheable(value = "myCacheName", keyGenerator = "myKeyGenerator") public Product getProduct(ProductRequest request) { // ... } And I need to set different time to live (expiration…
Sasha Shpota
  • 9,436
  • 14
  • 75
  • 148
12
votes
1 answer

Unable to get result from the Redis using Crud Repository in Spring Boot?

I am developing Spring Boot + Redis example. I've taken a reference from link : https://www.baeldung.com/spring-data-redis-tutorial. In this example, I developed repository method Student findByNameAndGender(String name, Gender gender); and even…
Jeff Cook
  • 7,956
  • 36
  • 115
  • 186
12
votes
1 answer

Expired key trigger event - Spring data Redis

I am trying to setup a Key expiry event handler using spring data redis but am not able to make it work. I did some research but dint yeild expected results. Not sure what i am missing. I would like to LOG a message when the key on the redis cache…
tindu edward
  • 299
  • 1
  • 3
  • 17
12
votes
3 answers

Spring Data Redis NoSuchBeanDefinitionException: No qualifying bean of type

When I try to inject repository that implements CrudRepository from Spring Data Redis, I get NoSuchBeanDefinitionException. Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type…
max_dev
  • 554
  • 2
  • 6
  • 15
12
votes
1 answer

Redis Serialization and Deserialization

I have noticed that some of my serialized objects stored in Redis have problems deserializing. This typically occurs when I make changes to the object class being stored in Redis. I want to understand the problem so that I can have a clear design…
11
votes
2 answers

Spring Session Data Redis - Get Valid Sessions, Current User from Redis Store

My question is, in distributed web application is it possible to get the valid sessions from Redis Store using RedisOperationSessionRepository. (I mean I don't want to write explicit code for putting it into Redis store and then later read it, I…
Shrikant Havale
  • 1,250
  • 1
  • 16
  • 36
10
votes
4 answers

ClassNotFoundException while JedisClient initialization in Spring Boot 2.5.4 application

I have a Spring Boot 2.5.4 application in which I would like to add Redis and access it via Spring Data Redis. My current configuration looks like this: pom.xml
Martin
  • 1,139
  • 4
  • 23
  • 49
10
votes
4 answers

how to configure redis ttl with spring boot 2.0

I am using redis in spring boot 2.0. I wanted the data stored in redis to be set to TTL. So I searched to find a way, and I wrote the following example code. Person.java @Data @Builder @RedisHash("Person") public class Person implements…
이상원
  • 103
  • 1
  • 1
  • 6
10
votes
3 answers

How can I migrate a RedisCacheManager with default expiration to Spring Data Redis 2.0?

I'm upgrading a project which uses Spring Data Redis to 2.x. Previously, the cache manager could be configured with a default expiration using RedisCacheManager.setDefaultExpiration(defaultExpireTime). This option does not seem to exist in 2.x. …
M. Justin
  • 14,487
  • 7
  • 91
  • 130
10
votes
4 answers

Redis - How to configure custom conversions

In spring-data-redis, How do we need configure custom converters that can be auto-wired/injected from Spring boot application or configuration. I read about @ReadingConverter and @WritingConverter from spring data redis documentation. From this…
Pachai
  • 101
  • 1
  • 1
  • 4
10
votes
4 answers

Enabling Redis cache in spring boot

I have following configuration on my spring boot project. @SpringBootApplication @EnableTransactionManagement @EnableCaching @EnableScheduling @EnableAsync public class Application { String redisHost = "localhost"; int redisPort = 6379; …
lsc
  • 681
  • 3
  • 8
  • 26
10
votes
11 answers

Cannot get connection for redisTemplate for Spring data redis

I'm trying to publish a message to a channel using Spring data Redis using Jedis. Here is a very simple Java config: @Bean(name="jedisConnectionFactory") JedisConnectionFactory jedisConnectionFactory() { JedisConnectionFactory factory = new…
Navin Viswanath
  • 894
  • 2
  • 13
  • 22
9
votes
1 answer

SpringData Redis Repository with complex key

We try to use the Spring Data CrudRepository in our project to provide persistency for our domain objects. For a start I chose REDIS as backend since in a first experiment with a CrudRepository it seemd, getting it…
9
votes
0 answers

Performance problems with Redis/Spring Data Redis

I have a performance problem in my Spring Boot application when it's communicating with Redis that I was hoping someone with expertise on the topic could shed some light on. Explanation of what I'm trying to do In short, my application I have 2…
fridberg
  • 161
  • 4
  • 14
9
votes
2 answers

Are spring-data-redis connections not properly released when transaction support is enabled?

In our Spring 4 project we would like to have database transactions that involve Redis and Hibernate. Whenever Hibernate fails, for example due to optimistic locking, the Redis transaction should be aborted as well. This seems to work…
1
2
3
68 69