Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring data redis key expiration

In spring data redis we have two variables.

RedisTemplate<Key, Value> redisTemplate;
HashOperations<Key, HashKey, HashValue> hashOperations;

There is a method expireAt(String key, Date date) inside RedisTemplate. So if I want to set an expiry for a particular hash key I can use this method or this only works at Key level and expires all the entries inside that key?

like image 410
TheNightsWatch Avatar asked Oct 20 '25 10:10

TheNightsWatch


1 Answers

If it helps anyone, I am using redisTemplate.expireAt(String Key, Date date) method for this purpose. It works for me.

like image 111
TheNightsWatch Avatar answered Oct 23 '25 00:10

TheNightsWatch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!