Redis - keys disappear

◇◆丶佛笑我妖孽 提交于 2021-01-27 07:08:43

问题


Is it possible to disappear keys in Redis without reason? I'm adding keys to redis:

Transaction transaction = jedis.multi();
transaction.incrBy(positionsQuantityKey, positionQuantity);
transaction.expire(positionsQuantityKey, 24 * 3600);
transaction.exec();

but after few minutes I ran command:

jedis.keys("*");

and the key disappeared. What could delete this key? I'm sure that expire time was succesfully set, because result of this command was 1.

I'm using redis 2.6


回答1:


If you're not doing anything else with Redis during that time, open a MONITOR session with redis-cli and look what goes on - another process could be deleting your key.

Alternatively, perhaps you're running low on RAM and Redis' eviction policy is configured to evict volatile keys.



来源:https://stackoverflow.com/questions/30510254/redis-keys-disappear

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!