【问题标题】:How can I find the last access time of a redis key?如何找到redis key的最后访问时间?
【发布时间】:2016-07-14 17:49:21
【问题描述】:

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

【问题讨论】:

    标签: redis


    【解决方案1】:

    查看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 作为服务时,您必须拥有管理员权限才能执行此操作 希望这会有所帮助!

    【讨论】:

    • "ERR 未知命令 'OBJECT'" -- 这是在 heroku redis 实例上
    • OBJECT IDLETIME foo
    • 此命令从 2.2.3 开始可用。你能检查你的redis版本吗?
    • 版本是3.2.1
    • 许多 Redis 提供商通过禁用选定的 Redis 命令来保护他们的服务 - OBJECT 就是一个常见的例子。
    猜你喜欢
    • 1970-01-01
    • 2014-12-02
    • 2018-02-04
    • 1970-01-01
    • 2021-05-02
    • 1970-01-01
    • 1970-01-01
    • 2020-10-13
    • 2014-06-18
    相关资源
    最近更新 更多