How to set maximum time for a key to store in Redis cache? Is there any configurable parameter for that
There are a few examples in documentation through configuration or object expiration.
Using configuration:
RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig()
.entryTtl(Duration.ofSeconds(1))
Using annotation on a class attribute or method
@TimeToLive
private Long expiration;
Expiration times can be set by using the @TimeToLive annotation on either a numeric property or a method