spring-data-redis icon indicating copy to clipboard operation
spring-data-redis copied to clipboard

Adding support to GETEX in Spring Redis Cache

Open danibs opened this issue 2 years ago • 0 comments

Hi, in version > 2.6: https://docs.spring.io/spring-data/data-redis/docs/current/reference/html/#new-in-2.6.0

you support GETEX command that permits (I think) to have a kind of "time to idle" like in EhCache (ExpiryPolicyBuilder.timeToIdleExpiration) where the key doesn't expire if someone get its value.

I updated my pom.xml with:

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-redis</artifactId>
    <version>2.7.1</version>
</dependency>

but in RedisCacheConfiguration class there is only Duration ttl attribute. I found this https://dzone.com/articles/how-to-boost-redis-with-local-caching-in-java but it talks about Redisson and I found in library that is possible to have timeToLive and Idle:

LocalCachedMapOptions.defaults()
   .evictionPolicy(EvictionPolicy.LFU)
   .timeToLive(48, TimeUnit.MINUTES)
   .maxIdle(24, TimeUnit.MINUTES);

Do I miss something? Thanks

danibs avatar Jun 28 '22 13:06 danibs