首页 > 代码库 > Redis 入门指令

Redis 入门指令

-- -- string
SET key value 
GET key 
GETRANGE key start end 
GETSET key value
GETBIT key offset
MGET key1 [key2..]
SETBIT key offset value
SETEX key seconds value
SETNX key value
SETRANGE key offset value
STRLEN key
MSET key value [key value ...]
MSETNX key value [key value ...] 
PSETEX key milliseconds value
INCR key
INCRBY key increment
INCRBYFLOAT key increment
DECR key
DECRBY key decrement
APPEND key value


-- -- hash
HDEL key field2 [field2] 
HEXISTS key field 
HGET key field 
HGETALL key 
HINCRBY key field increment 
HINCRBYFLOAT key field increment 
HKEYS key 
HLEN key 
HMGET key field1 [field2] 
HSET key field value 
HSETNX key field value 
HVALS key 
HSCAN key cursor [MATCH pattern] [COUNT count] 


-- -- list
BLPOP key1 [key2 ] timeout 
BRPOP key1 [key2 ] timeout 
BRPOPLPUSH source destination timeout 
LINDEX key index 
LINSERT key BEFORE|AFTER pivot value 
LLEN key 
LPOP key 
LPUSH key value1 [value2] 
LPUSHX key value 
LRANGE key start stop 
LREM key count value 
LSET key index value 
LTRIM key start stop 
RPOP key 
RPOPLPUSH source destination 
RPUSH key value1 [value2] 
RPUSHX key value 

-- -- set
SADD key member1 [member2] 
SCARD key 
SDIFF key1 [key2] 
SDIFFSTORE destination key1 [key2] 
SINTER key1 [key2] 
SINTERSTORE destination key1 [key2] 
SISMEMBER key member 
SMEMBERS key 
SMOVE source destination member 
SPOP key 
SRANDMEMBER key [count] 
SREM key member1 [member2] 
SUNION key1 [key2] 
SUNIONSTORE destination key1 [key2] 
SSCAN key cursor [MATCH pattern] [COUNT count] 

-- -- zset
ZADD key score1 member1 [score2 member2] 
ZCARD key 
ZCOUNT key min max 
ZINCRBY key increment member 
ZINTERSTORE destination numkeys key [key ...] 
ZLEXCOUNT key min max 
ZRANGE key start stop [WITHSCORES] 
ZRANGEBYLEX key min max [LIMIT offset count] 
ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT] 
ZRANK key member 
ZREM key member [member ...] 
ZREMRANGEBYLEX key min max 
ZREMRANGEBYRANK key start stop 
ZREMRANGEBYSCORE key min max 
ZREVRANGE key start stop [WITHSCORES] 
ZREVRANGEBYSCORE key max min [WITHSCORES] 
ZREVRANK key member 
ZSCORE key member 
ZUNIONSTORE destination numkeys key [key ...] 
ZSCAN key cursor [MATCH pattern] [COUNT count] 

-- -- HyperLogLog
PFADD key element [element ...] 
PFCOUNT key [key ...] 
PFMERGE destkey sourcekey [sourcekey ...] 

-- -- PUBLISH/SUBSCRIBE
PSUBSCRIBE pattern [pattern ...] 
PUBSUB subcommand [argument [argument ...]] 
PUBLISH channel message 
PUNSUBSCRIBE [pattern [pattern ...]] 
SUBSCRIBE channel [channel ...] 
UNSUBSCRIBE [channel [channel ...]] 

-- -- MULTI -- “  ” -- EXEC 
DISCARD 
EXEC 
MULTI 
UNWATCH 
WATCH key [key ...] 

-- -- EVAL
EVAL script numkeys key [key ...] arg [arg ...] 
EVALSHA sha1 numkeys key [key ...] arg [arg ...] 
SCRIPT EXISTS script [script ...] 
SCRIPT FLUSH 
SCRIPT KILL 
SCRIPT LOAD script 

-- -- 连接
AUTH password 
ECHO message 
PING 
QUIT 
SELECT index 

-- -- server
BGREWRITEAOF
BGSAVE 
CLIENT KILL [ip:port] [ID client-id] 
CLIENT LIST 
CLIENT GETNAME 
CLIENT PAUSE timeout 
CLIENT SETNAME connection-name 
CLUSTER SLOTS 
COMMAND 
COMMAND COUNT 
COMMAND GETKEYS 
TIME 
COMMAND INFO command-name [command-name ...] 
CONFIG GET parameter 
CONFIG REWRITE 
CONFIG SET parameter value 
CONFIG RESETSTAT 
DBSIZE 
DEBUG OBJECT key 
DEBUG SEGFAULT 
FLUSHALL 
FLUSHDB 
INFO [section] 
LASTSAVE 
MONITOR 
ROLE 
SAVE 
SHUTDOWN [NOSAVE] [SAVE] 
SLAVEOF host port 
SLOWLOG subcommand [argument] 
SYNC 

=======================

-- -- 

啦啦啦

Redis 入门指令