Skip to content

help [command] 查看一个命令的具体用法

  • KEYS

    查询 key

    KEYS *

    KEYS h?llo matches hello, hallo and hxllo KEYS h*llo matches hllo and heeeello KEYS h[ae]llo matches hello and hallo, but not hillo KEYS h[^e]llo matches hallo, hbllo, ... but not hello KEYS h[a-b]llo matches hallo and hbllo Use \ to escape special characters if you want to match them verbatim.

  • DEL

    删除 key,返回值是删除的数量。

    DEL foo DEL foo bar

  • EXISTS

    判断 key 是否存在,返回 0 表示不存在,返回 1 表示存在。

    EXISTS foo

  • EXPIRE

    给 key 设置有效期,到期后会被自动删除。

    EXPIRE foo 10

  • TTL

    查看 key 的剩余有效期,返回值为 -1 表示永久有效,返回值为 -2 代表已经过期被删除了。

    TTL foo

  • FLUSHALL

    清空所有 key