Redis1
来源:互联网 发布:小米云服务软件 编辑:程序博客网 时间:2024/06/07 03:49
Commands
key
- exists
- set - getset(override)
- get
- del
- expire - persist - ttl
EXPIRE key seconds
String
- set - get
- setnx - setex
- incr - decr - incrby - decrby
- mset - mget - msetnx
MSET key value [key value ...]
List
- lpush - lpushx - lpop
rpush - rpushx - rpop
堆栈 FILO lpushx(lpush) - rpop
队列 FIFO rpushx(rpush) - lpoplset
- lindex
Hash
- hset - hget - hgetall - hsetnx - hdel
- hmset - hmget
- hlen - hkeys - hvals
Set
- sadd - spop
- smembers
- sunion - sdiff
SortedSet
- zadd - zrem - zrange
Pub/Sub
- publish - subscribe
- psubscribe - punsubscribe
- unsubscribe
- pubsub
Transaction
- multi - exec - disacrd
- watch - unwatch
Connection
- auth
- echo
- ping
- quit
- select
Server
- client kill - list - setname
- config get - set - rewrite - resetstat
- debug object - segfault
- flushdb - flushall
- info
- save - bgsave
- sync
- lastsave
- shutdown
- slowlog
- monitor
- time
Usage
Keyspace
Keyspace notifications allows clients to subscribe to Pub/Sub channels in order to receive events affecting the Redis data set in some way.
Because Redis Pub/Sub is frie and forget currently there is no way to use this feature if you application demands reliable notification of events.
Config
config set/get notify-keyspace-events KEg$lshzxe
Transaction
Either all of the commands or none are processed, so a Redis transaction is automic.
When using the append-only file Redis makes usre to use a single write(2) syscall to write the transaction on disk.If the server crashes in some hard way, use the redis-check-aof tool is possible to fix the append only file.
From 2.6.5, the way to handle transaction queue is pipline. So the errors in queue will not be exec also the client will cancel all the pipline.
check-and-set CAS
WATCH mykeyval = GET mykeyval = val + 1MULTISET mykey $valEXEC
exec wile reset the watch whatever how many keys is watched.
ZPOP
WATCH zsetelement = ZRANGE zset 0 0MULTI ZREM zset elementEXEC
Pub/Sub
TODO
- Redis1
- redis1
- redis1
- Redis1
- redis1安装以及使用
- “面向结果解决问题”
- VR系列——Oculus Rift 开发者指南:三、Oculus Rift的渲染(四)
- 11--MySQL数据查询应用(实战)(二)
- Spring之事务管理理解
- Java中,重载和重写是否是多态?
- Redis1
- 走进SharedPreferences
- SQL Server2005管道的另一端上无任何进程——解决方案
- 无法在JDK源码中设置断点---- unable to install breakpoint in ....due to missing line number attributes
- foreach和&共用出现的问题
- HeidiSQL中文乱码解决
- 登录功能
- 直接拿来用!十大Material Design开源项目
- 16位汇编指令