I am migrating my traditional Redis cache to the Spring Data Reactive Redis. After migration I would like to test if my new integration works as expected but I faced a problem with getting key/keys from particular Redis Db, namely: My redisConfiguration class looks like this: My “test” class looks…
Tag: spring-data-redis
Spring Data with Redis: How do I use a different LocalDateTime format or a different convertor?
I have data in my DB for field date with the following format: 2021-09-21 11:25:36. The Redis field is of type TEXT. When I’m trying to read the data from date field from the DB, I get following exception: How can I assign a different convertor to this field in my entity or annotate that my LocalDateTim…
Access Redis connection pool using Spring Data Redis without Reflection API
Please help me here with the solution. I want to monitor and periodically log information about the Redis Connection Pool usage in my application. I am using use Redis via spring-data-redis RedisTemplate object. I know that we can access pool through Reflection API as below. Since the pool is accessing throug…
Spring data redis – How to use hashOperation’s scan method to get keys or values based on pattern?
I have never worked on Redis and Spring boot. I want to use Redis as a cache. I have been using hashOperations for get/set operations. I have configured the RedisTemplate to stop weird hashes from getting prepended to a key. I have a class called Post which I am caching. A user can create multiple posts. The …
Collection Object lost due to redis TTL using redission client
We are using Redission client for java to get the data from redis but object gets deleted from collection due to TTL. Example We are trying the below approach to get the data from Redis with TTL. final RList rList = client.getList(getEnvCacheKey(cacheKey)); rList.expire(7L, TimeUnit.SECONDS); rlist.add(“…
Spring Security returns 403 instead of 401 and creates invalid Redis session cookie
I’m using Spring Security and Spring Data Redis to keep track of user sessions with custom roles and entitlements. When I try to hit a PreAuthorized endpoint without a session cookie in my browser, it should return a 401. Instead a new (invalid) session cookie is created and the endpoint returns a 403. …
Access Redis connection pool using Spring Data Redis
I want to monitor and periodically log information about the Redis Connection Pool usage. I use Redis through spring-data-redis RedisTemplate object. Is there any way to access pool? Answer I was able to access internal pool using reflection API.
Read data saved by spark redis using Java
I using spark-redis to save Dataset to Redis. Then I read this data by using Spring data redis: This object I save to redis: Save object by using spark-redis: Repository: I can’t read this data have been saved in Redis by using Spring data redis because structure data saved by spark-redis and spring dat…