如何找到redis密钥的上次访问时间?

时间:2016-07-14 17:49:22

标签: redis

在redis中,两个驱逐策略allkeys-lru和volatile-lru根据访问时间驱逐密钥。所以,这些信息必须存在于某处。我可以查询密钥的访问时间吗?或者,更好的是,根据访问时间翻阅排序的密钥列表?

1 个答案:

答案 0 :(得分:6)

查看Object IDLETIME它给出了对象空闲的时间

在@Itamar Haber的指导下,他们禁用某些命令的方式是使用redis.conf

# It is also possible to completely kill a command by renaming it into
# an empty string:
#
rename-command FLUSHDB ""
rename-command FLUSHALL ""
rename-command DEBUG ""

当您在Heroku上使用Redis作为服务时,您必须拥有管理员权限才能执行此操作 希望这有帮助!