我想要一些像redis set和ttl这样的东西,例如
公开空放(K键,V值,int timeToLive,TimeUnit timeUnit);
还有一个redis没有提供的手术
公开putWithIdle(K键,V值,int timeToIdle,TimeUnit timeUnit);
发布于 2017-11-03 13:24:46
这方面没有直接API,但是在对值进行put处理之后,您可以按照这里描述的更改过期时间( https://cache2k.org/docs/1.0/user-guide.html#entry-processor )
cache.invoke("key", e -> e.setValue("value").setExpiry(System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(120)));
考虑在https://github.com/cache2k/cache2k/issues上创建一个特性请求
https://stackoverflow.com/questions/47094626
复制相似问题