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
6
votes
1 answer

Is there a way to use a entity with @RedisHash in Redis and in a relational Database?

I am using Spring boot. To save my entities on relational database, I configured a datasource and my domain classes, e.g.: @Entity @Table(schema = "schema_name", name = "tb_name") public class table_name extends DomainEntity { private…
Lucas Amorim Silva
  • 567
  • 1
  • 7
  • 14
6
votes
4 answers

How can I easily cache Kotlin Objects in Redis using json via Jackson?

I have a Spring boot app written in Kotlin where I would like to enable caching in Redis. I'd like to have the objects stored as serialized JSON and ideally don't want to have to register each type that could be potentially cached. I have some…
AwesomeTown
  • 2,800
  • 2
  • 27
  • 41
6
votes
5 answers

How to get same rank for same scores in Redis' ZRANK?

If I have 5 members with scores as follows a - 1 b - 2 c - 3 d - 3 e - 5 ZRANK of c returns 2, ZRANK of d returns 3 Is there a way to get same rank for same scores? Example: ZRANK c = 2, d = 2, e = 3 If yes, then how to implement that in…
Ankit Gajra
  • 133
  • 2
  • 9
6
votes
2 answers

set expire key at specific time when using Spring caching with Redis

I am spring caching abstraction annotations to apply caching to my service methods. Since I am using Redis as the cache store, I want to use the option of expiring cache at a specific time, since that is supported by Redis. expireat command in redis…
juser
  • 359
  • 1
  • 7
  • 17
6
votes
1 answer

How to prevent Redis writes for anonymous user sessions

I have this sample application: package com.example.session; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Configuration; import…
6
votes
1 answer

delete key/value from redis - phantom key not deleted

I'm using a Spring Redis repository and I'm puzzled with the delete operation and the phantom key. When a delete is performed, the phantom key is not deleted, is it a normal behaviour ? If yes, is it possible to force a deletion of the phantom key…
aure_bobo
  • 138
  • 2
  • 8
6
votes
1 answer

Spring data redis - listen to expiration event

I would like to listen expiration events with KeyExpirationEventMessageListener but I can't find an example. Someone know how to do it using Spring boot 1.4.3 & Spring Data Redis? I am currently doing this JedisPool pool = new JedisPool(new…
BkSouX
  • 739
  • 5
  • 13
  • 29
6
votes
2 answers

Spring Data Redis: Setting a Password

I have a need to provide a secure connection to Redis from my microservices. So if I want to add the ability to support authentication so that a client can send an AUTH command with a password. See http://redis.io/topics/security How can I do this…
EvilJinious1
  • 2,773
  • 6
  • 43
  • 63
6
votes
1 answer

Specify which logical database to use with spring-data-redis

I'm using spring-data-redis, spring-session and Spring Boot to connect to my Redis instance. However I would like spring-data-redis to connect not to DB 0 (which is default) but to another local database (say DB 1). This is where I'd like the…
Johan
  • 37,479
  • 32
  • 149
  • 237
6
votes
2 answers

Getting a lost Sentinel error message for Redis

I am running a spring boot service using spring data redis and here is the following configuration. The service seems to work but I am seeing a stream of Lost Sentinel messages in the logs. The sentinel nodes are reachable form the VM where I am…
EvilJinious1
  • 2,773
  • 6
  • 43
  • 63
5
votes
0 answers

How to connect to AWS ElastiCache using primary and reader endpoints

My application uses AWSElastiCache for session storage. Created a redis instance (Cluster Mode Disabled) with 1 primary and 2 replica nodes. I am using Lettuce as Redis client which is internal to Spring boot to connect with Redis. I am using…
5
votes
1 answer

CRUD repository bean not found exception

I have an application which connects to AWS DynamoDB. I am trying to implement Redis connection using Jedis into this application. However, just after I add this dependency - org.springframework.boot
5
votes
1 answer

When using spring-boot-starter-data-redis, how to set the eviction policy? LFU or LRU etc?

When redis is used as a caching technology through spring boot (spring-boot-starter-data-redis), i see few properties like TTL can be set in the application.properties…
samshers
  • 1
  • 6
  • 37
  • 84
5
votes
1 answer

OutOfDirectMemoryError using Spring-Data-Redis with Lettuce in a multi-threading context

We are using spring-data-redis with the spring-cache abstraction and lettuce as our redis-client. Additionally we use multi-threading and async execution on some methods. An example workflow would look like this: Main-Method A (main-thread) -->…
5
votes
1 answer

Why does Spring-data-redis use keys command when cache evict

I use redis as my cache server when i use springboot. But i read the spring-data-redis source, when evict cache, the code is byte[][] keys = Optional.ofNullable(connection.keys(pattern)).orElse(Collections.emptySet()) …
hongwei
  • 71
  • 6