Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2203

How to cache objects in redis in their specific regions using RedisTemplate and without using @Cacheable, @CachePut?

$
0
0

I want to cache two different Java objects or POJOS in two different regions in Redis. I want the following region structure in Redis.

MyRegions::Product

MyRegions::Order

The Product objects should be saved under MyRegions::Product and the Order objects should be saved under MyRegions::Order

I don't want to use @Cacheable(cacheNames = "RegionName") and @CachePut(cacheNames = "RegionName") as it didn't work in my office project. I am forced to use org.springframework.data.redis.core.RedisTemplate as I need to save the object in a format that is human readable.

I'm using the below serializers

StringRedisSerializer for serializing keys

GenericToStringSerializer for serializing HashValue

GenericJackson2JsonRedisSerializer for serializing Values.

Below is the link to the project in my Git Repo.https://github.com/abhijitnath90/spring-boot-redis-example.githttps://github.com/abhijitnath90/spring-boot-redis-example

RedisInsight RedisCache Image


Viewing all articles
Browse latest Browse all 2203

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>