Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

全局指令-查询

  • 键总数——复杂度O(1)

    dbsize
    
  • 检查键是否存在

    exists key
    
  • 键的数据结构类型

    type key
    
  • 键的内部编码实现

    object encoding key
    
  • 查询键的过期时间(秒级)

    ttl key
    
    • 大于等于0,即按秒计算的过期时间
    • -1 键没设置过期时间
    • -2 键不存在
  • 查询键的过期时间(毫秒级)

    pttl key
    
  • 随机返回一个键

    randomkey
    
  • 输出所有键(慎用)

    keys *