Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2203

Collection Object lost due to redis TTL using redission client

$
0
0

We are using Redission client for java to get the data from redis but object gets deleted from collection due to TTL.

Example

We are trying the below approach to get the data from Redis with TTL.

final RList rList = client.getList(getEnvCacheKey(cacheKey));

rList.expire(7L, TimeUnit.SECONDS);

rlist.add("Value1");

rlist.add("Value2");

assertThat(rList).containsOnly("Value1", "Value2"); // This condition is true until 7 seconds

Now after 7 secondsassert rlist.size() == 2 condition becomes false since object references are deleted due to TTL.

Due this we landed up in a production issue. Is there any way we can retain the objects even after TTL? Any sort of help will be appreciated.


Viewing all articles
Browse latest Browse all 2203

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>