简体   繁体   English

如何在 Java 中使用 Redisson 客户端更新条目的生存时间?

[英]How to update time-to-live of an entry using Redisson client in Java?

Let's say I'd like to store an object A in Redis using RMapCacheReactive and Redisson.假设我想使用RMapCacheReactive和 Redisson 在 Redis 中存储一个 object A
In the beginning, I put it into the map with 10 000 ms TTL by the key B .一开始,我通过密钥B将其放入具有 10 000 ms TTL 的 map。 Right after that, I put the same object A by the same key B but with zero TTL.在那之后,我将相同的 object A放在相同的密钥B上,但 TTL 为零。
According to the documentation, the put method "stores value mapped by the key with a specified time to live" so my expectation was that A would be stored in that map permanently.根据文档,put 方法“存储由具有指定生存时间的键映射的值”,因此我的期望是A将永久存储在 map 中。
However, it was actually removed after that 10 000 ms passed (it became impossible to get it using Redisson client).然而,它实际上在 10 000 毫秒过去后被删除(使用 Redisson 客户端无法获取它)。 Is there a thing that I got wrong?有什么地方我弄错了吗?

I checked this behaviour on 3.13.4 and 3.12.5 versions of Redisson.我在 3.13.4 和 3.12.5 版本的 Redisson 上检查了这种行为。

I reported this issue on GitHub https://github.com/redisson/redisson/issues/3078 .我在 GitHub https://github.com/redisson/redisson/issues/3078上报告了这个问题。 Turned out that that was a bug that should be fixed in the next version (3.13.5).原来这是一个应该在下一个版本 (3.13.5) 中修复的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未使用 spring-cache 设置 GemFire 条目 Time-To-Live - GemFire entry Time-To-Live is not getting set using spring-cache Java-通过通过MulticastSocket发送来减少UDP数据包的生存时间? - Java - reduce Time-To-Live of UDP packet by sending it via MulticastSocket? 如何使用Hector为Cassandra中的列设置生存时间? - how set time-to-live for column in Cassandra with Hector? 在运行时配置生存时间属性 - Configuring time-to-live property at run time 有没有一种方法可以使用Table(azure-storage)客户端API使用CosmosDb设置项目级别TTL(生存时间)? - Is there a way to set item level TTL(Time-To-Live) with CosmosDb utilizing the Table (azure-storage) client API? 如何为使用 Redisson Live Objects 创建的 POJO 指定生存时间? - How to specify Time to Live for POJO created with Redisson Live Objects? "如何使用redisson客户端获取当前时间" - how to get the current time by use redisson client 带有生存时间的 EHcache 简单示例 - EHcache simple example with time-to-live ehcache3获得生存时间配置 - Ehcache3 get time-to-live configuration 如何使用Java客户端更新Elastic Search上的条目 - How to update an entry on Elastic Search using Java client
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM