Redis 基本操作(一)

119 阅读1分钟

Redis的命令大体上分成两种

功能性命令

添加一个名key为name,值为zhangsan的项: set name zhangsan 将key为name对应的值修改为lisi: set name lisi

辅助性命令

清屏

清楚当前屏幕的输出: clear

帮助

也分为两大类:

help COMMAND
help @group

直接在客户端输入help会列出帮助命令类型,例如

redis-cli 3.2.100
To get help about Redis commands type:
      "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

比如你想查看get的帮助命令: help get,得到如下输出:

  GET key
  summary: Get the value of a key
  since: 1.0.0
  group: string

其中group就是string,说明get的操作类型是对string进行操作. 如果想进一步查看string的帮助内容,可以使用: help @string,得到如下结果

  APPEND key value
  summary: Append a value to a key
  since: 2.0.0

  BITCOUNT key [start end]
  summary: Count set bits in a string
  since: 2.6.0

  BITFIELD key [GET type offset] [SET type offset value] [INCRBY type offset increment] [OVERFLOW WRAP|SAT|FAIL]
  summary: Perform arbitrary bitfield integer operations on strings
  since: 3.2.0
...

退出

在windows 平台下,可以用以下方式退出

Esc
ctrl c
quit
exit

在linux下我们常用

quit
exit