2016-07-14 86 views
2

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

回答

5

Object IDLETIME它提供了时间,对象是空闲的

由当您使用Redis的使用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 "" 

引导通过@Itamar哈伯他们禁用方法的一些命令作为Heroku的服务,你必须拥有管理员权限才能做到这一点 希望这有助于! “

+0

”ERR未知命令'OBJECT'“ - 这是在一个heroku redis实例 –

+0

你能分享你正在尝试的命令的语法吗? –

+0

'OBJECT IDLETIME foo' –