gpt4 book ai didi

Redis - 旧数据丢失

转载 作者:IT王子 更新时间:2023-10-29 06:13:19 25 4
gpt4 key购买 nike

我们使用 redis 来存储购物车数据。我们看到一些超过一个月的购物车不再可用。我假设数据会被持久化并且应该随时可用。是否有任何我必须检查的设置以检查为什么某些旧数据被删除?存储数据时没有设置TTL。

最佳答案

也许它达到了你的redis ma​​xmemory,看看redis.conf中的两个配置ma​​xmemoryma​​xmemory-policy

当达到 maxmemory 时,redis 遵循 maxmemory-policy 指定的操作,可以是 allkeys-lru 或 noeviction。如果策略是 lru,旧数据将被丢弃。

正如 redis 文档所说:

noeviction: return errors when the memory limit was reached and the client is trying to execute commands that could result in more memory to be used (most write commands, but DEL and a few more exceptions).

allkeys-lru: evict keys by trying to remove the less recently used (LRU) keys first, in order to make space for the new data added.

关于Redis - 旧数据丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45760819/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com