Redis使用(1)
在命令行中(cli文件中)使用tab键自动换大写
默认端口号 6379
选择数据库(默认一共16个库)select dbid
清除库 flushDB 清空当前库
flushAll 清空所有库
插值 set key value
查询 keys key变量名 (keys * 查询全部)
keys H?llo 匹配hello hallo等
keys H*llo 匹配hllo heeeello等
keys h[ae]llo 匹配hello和hallo
删除 del key (用空格分割多个key 可以删除多个)
判断是否存在 exists key 存在返回1 可以写多个key,有一个可以存在则返回1
生存时间 expire key time(默认秒)
pexpire key time(默认毫秒)
查询生存时间 ttl key 返回剩余时间
pttl key
移动数据move key 目标dbid
随即返回key random 返回但不删除