0

I have implemented redis cache in my springboot project. There is a date column in a table which needs to be updated when a user access a company account. This column update should be done only when redis cache expires I tried creating redisTemplate and used redis.getExpire method to know the time remains for the cache to expire. But that redisTemplate getExpire will get triggered only when the method is called. What can I do so that even when I don't call the method that condition will be checked and column gets updated

Sai
  • 1
  • 1

1 Answers1

0

If you are setting TTL for keys in redis then you can listen for expiration events. for this first you need to enable event publishing in redis server and then create a listener in java which will receive expiration events.

Please go through below is answer on stackoverflow for code help.

Spring data redis - listen to expiration event