redis 基础 一:帮助文档的查看

博客地址:http://blog.lingang.me/2014/03/31/redis-jichu-1/

1、联上 redis-cli 之后输入 “?” 或者 “help”回车:

redis 127.0.0.1:6379> ?
redis-cli 2.6.14Type: “help @<group>” to get a list of commands in <group>

      “help <command>” for help on <command>

      “help <tab>” to get a list of possible help topics

      “quit” to exit

从这里可以得到的信息有:

    输入 help @<group> 可以查到一组操作的使用,group 为操作的分组,比如 list 为一组操作,hash 为一组操作 server 为一组操作。比如输入 help @hash 能得到处理哈希类型的所有操作的解释以开始支持版本:

redis 127.0.0.1:6379> help @hash

HDEL key field [field ...]

summary: Delete one or more hash fields

since: 2.0.0

 

HEXISTS key field

summary: Determine if a hash field exists

since: 2.0.0

 

HGET key field

summary: Get the value of a hash field

since: 2.0.0

 

HGETALL key

summary: Get all the fields and values in a hash

since: 2.0.0

 

第二行 help <command> 可以查看一个命令的详情,比如输入 help lpop 能查看 lpop 的操作详情:

 

redis 127.0.0.1:6379> help lpop

LPOP key

summary: Remove and get the first element in a list

since: 1.0.0

 

group: list

 

当你不知道有哪些分组和哪些命令时,可以直接输入 help 然后空格然后按 tab 键,会逐一为你列举:

redis 127.0.0.1:6379> help @generic

redis 127.0.0.1:6379> help @string

注意:此处以@符开头的能得到一组操作。

当你记不清楚一个命令时,可以输入头一个或几个字符,然后按tab,会逐一为你列举符合以你输入为开头的命令,比如:

redis 127.0.0.1:6379> help LPOP

redis 127.0.0.1:6379> help LPUSH

 

好了,掌握了以上几种用法,已经足以你看遍所有 redis 命令了。