键值操作
get key
set key value
incr key
decr key
del key [key ...]
rename key newkey
renamenx key newkey
keys pattern
incrby key increment
incrbyfloat key increment
append key value
decrby key decrement
dump key
restore key ttl serialized-value
exists key
getbit key offset
getset key value
setnx key value
mget key [key ...]
mset key value [key value ...]
msetnx key value [key value ...]
flushall 删除所有数据库的数据
flushdb 删除当前数据库的所有数据
move key db
randomkey
setbit key offset value
setrange key offset value
strlen key
type key
操作hash数组
hdel key field [field ...]
hexists key field
hget key field
hgetall key
hincrby key field increment
hincrbyfloat key field increment
hkeys key
hlen key
hmget key field [field ...]
hmset key field value [field value ...]
hset key field value
hsetnx key filed value
hvals key
操作列表
blpop key [key ...] timeout
brpop key [key ...] timeout
brpoplpush source destination timeout
getrange
lindex key index
linsert key before|after pivot value
llen key
lpop key
lpush key value [value ...]
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 value [value ...]
rpushx key value
Set操作
sadd key member [member ...]
scard key 获取set中元素总数
sdiff key [key ...]
ssdiffstore destination key [key ...]
sinter key [key ...]
sinterstore destination key [key ...]
sismember key member
smembers key
smove source destination member
sort key [by pattern] [limit offset count] [get pattern [get pattern ...]] [asc|desc] [alpha] [store destination]
spop key
srandmember key
srem key member [member ...]
sunion key [key ...]
sunionstore destination key [key ...]
zadd key score member [score] [member]
zcard key
zcount key min max
zincrby key increment member
zinterstore destination member key [key ...]
zrange key start stop [withscores]
zrangebyscore key min max
zrank key member
zrem key member [member ...]
zremrangebyrank key start stop
zremrangebyscore key min max
zrevrange key start top [withscores]
zrevrangebyscore key max min [withscores]
zrevrank key member
zscore key member
zunionstore destination numbers key [key ...]
键值生命周期管理
pexpire key milliseconds
pexpireat key milliseconds-timestamp
expire key seconds
expireat key timestamp
persist key
psetex key milliseconds value
pttl key
setex key seconds value
ttl key
事务
multi 标识一次事务的开始
订阅相关
psubscribe pattern [pattern ...]
publish channel message
punsubscribe [pattern [pattern ...]]
subscribe channel [channel ...]
unsubscribe [channel [channel ...]]
配置获取
config get parameter
config set parameter value
config resetstat
数据库操作
dbsize
info
select index
discard
exec
quit
shutdown [nosave] [save]
调试与监控相关
debug object key
debug segfault
echo message
monitor
object subcommand [arguments [arguments ...]]
ping
slowlog subcommand [argument]
time
unwatch
watch key [key ...]
授权
auth password
数据持久化存储
bgrewriteaof
bgsave
lastsave
save
外部扩展
eval script numkeys key [key ...] arg [arg ...]
script exists script [script ...]
script flush 删除所有缓存的脚本
script kill
script load script
migrate host port destination-db timeout
slaveof host port
sync
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:Redis Command - Python技术站