Sort by:
sort mylist 排序
sort mylist alpha desc limit 0 2 字母排序
sort list by it:* desc by命令
sort list by it:* desc get it:* get参数
sort list by it:* desc get it:* store sorc:result sort命令之store参数:表示把sort查询的结果集保存起来
Subscribe to the publication:
订阅频道:subscribe chat1
发布消息:publish chat1 "hell0 ni hao"
查看频道:pubsub channels
查看某个频道的订阅者数量: pubsub numsub chat1
退订指定频道: unsubscrible chat1 , punsubscribe java.*
订阅一组频道: psubscribe java.*
redis things:
- Isolation, atomicity,
- Step: Start a transaction, execute commands, commit the transaction
multi //开启事务
sadd myset a b c
sadd myset e f g
lpush mylist aa bb cc
lpush mylist dd ff gg
Server Management:
- dump.rdb: RDB way of backup files
- appendonly.aof: AOF way of backup files
- BgRewriteAof asynchronous execution of a aop (appendOnly file) overwriting files, it creates an optimized version of the current file size of AOF
BgSave #后台异步保存数据到磁盘,会在当前目录下创建文件dump.rdb
save #同步保存数据到磁盘,会阻塞主进程,别的客户端无法连接
client kill #关闭客户端连接
client list #列出所有的客户端
#给客户端设置一个名称
client setname myclient1
client getname
config get port
configRewrite #对redis的配置文件进行改写