I am using RedisCache.putIfAbsent
operation of spring-data-redis-1.6.2.RELEASE.jar to set the element value atomically along with the ttl
value.
This is how I generate the Cache Manager instance
public CacheManager dsyncCacheManager() {
RedisCacheManager redisCacheManager = new RedisCacheManager( redisTemplate() );
redisCacheManager.setDefaultExpiration(defaultExpireTimeSeconds);
return redisCacheManager;
}
This is how I call the method
cache.putIfAbsent( key, value );
However, When I go and check the ttl
of the given key in redis, the value returned is -1
and not the expected ttl
I used.