Redis支持的命令命令列表
Redis 支持5种数据类型
string,hash, list,set和zset
|
命令 |
处理函数位置 |
解释 |
|
get |
(t_string.c) |
|
|
set |
(t_string.c) |
设Key命令 |
|
setnx |
(t_string.c) |
键不存在时赋值 |
|
setex |
(t_string.c) |
键存在时赋值 |
|
psetex |
(t_string.c) |
|
|
append |
t_string.c |
向尾部増加值 |
|
strlen |
t_string.c |
获得字符串长度 |
|
del |
db.c |
删除键 |
|
exists |
db.c |
|
|
setbit |
bitops.c |
位操作 |
|
getbit |
bitops.c |
|
|
setrange |
t_string.c |
|
|
getrange |
t_string.c |
|
|
substr |
(同getrange)t_string.c |
|
|
incr |
t_string.c |
变量自赠 |
|
decr |
t_string.c |
|
|
mget |
t_string.c |
同时获得/设置多个键值 |
|
rpush |
t_list.c |
向list右边增加元素 |
|
lpush |
t_list.c |
向list左边增加元素 |
|
rpushx |
t_list.c |
|
|
lpushx |
t_list.c |
|
|
linsert |
t_list.c |
|
|
rpop |
t_list.c |
向list右边弹出元素 |
|
lpop |
t_list.c |
向list左边增加元素 |
|
brpop |
t_list.c |
|
|
brpoplpush |
t_list.c |
|
|
blpop |
t_list.c |
|
|
llen |
t_list.c |
|
|
lindex |
t_list.c |
获得索引元素值 |
|
lset |
t_list.c |
设置list索引key值 |
|
lrange |
t_list.c |
|
|
ltrim |
t_list.c |
只保留指定片段 |
|
lrem |
t_list.c |
|
|
rpoplpush |
t_list.c |
右转到左 |
|
sadd |
t_set.c |
增加/删除元素 |
|
srem |
t_set.c |
|
|
smove |
t_set.c |
|
|
sismember |
t_set.c |
判断元素是否在集合中 |
|
scard |
t_set.c |
|
|
spop |
t_set.c |
|
|
srandommember |
t_set.c |
|
|
sinter |
t_set.c |
|
|
sinterstore |
t_set.c |
|
|
sunion |
t_set.c |
|
|
sunionstore |
t_set.c |
|
|
sdiff |
t_set.c |
集合操作 |
|
sdiffstore |
t_set.c |
|
|
smembers |
(sintercommand)t_set.c |
|
|
sscan |
t_set.c |
|
|
zadd |
t_zset.c |
有序表增加元素 |
|
zincrby |
t_zset.c |
|
|
zrem |
t_zset.c |
有序表减去元素 |
|
zremrangebyscore |
t_zset.c |
|
|
zremrangebyrank |
t_zset.c |
|
|
zremrangebylex |
t_zset.c |
|
|
zunionstore |
t_zset.c |
|
|
zinterstore |
t_zset.c |
|
|
zrange |
t_zset.c |
获得排名在某个范围的元素列表 |
|
zrangebyscore |
t_zset.c |
|
|
zrevrangebyscore |
t_zset.c |
按照分数范围删除元素 |
|
zrangebylex |
t_zset.c |
|
|
zrevrangebylex |
t_zset.c |
|
|
zcount |
t_zset.c |
|
|
zlexcount |
t_zset.c |
|
|
zrevrange |
t_zset.c |
|
|
zcard |
t_zset.c |
获得元素的个数 |
|
zscore |
t_zset.c |
|
|
zrank |
t_zset.c |
获得元素的排名 |
|
zrevrank |
t_zset.c |
|
|
zscan |
t_zset.c |
|
|
hset |
t_hash.c |
hash的set操作 |
|
hsetnx |
t_hash.c |
键不存在时赋值 |
|
hget |
t_hash.c |
hash的get操作 |
|
hmset |
t_hash.c |
hash的mset操作 |
|
hmget |
t_hash.c |
hash的mget操作 |
|
hincrby |
t_hash.c |
|
|
hincrbyfloat |
t_hash.c |
|
|
hdel |
t_hash.c |
... |
|
hlen |
t_hash.c |
|
|
hkeys |
t_hash.c |
|
|
hvals |
t_hash.c |
|
|
hgetall |
t_hash.c |
|
|
hexists |
t_hash.c |
检查hash key是否存在 |
|
hscan |
t_hash.c |
|
|
incrby |
t_string.c |
|
|
decrby |
t_string.c |
|
|
incrbyfloat |
t_string.c |
|
|
getset |
t_string.c |
|
|
mset |
t_string.c |
|
|
msetnx |
t_string.c |
|
|
randomkey |
db.c |
|
|
select |
db.c |
|
|
move |
db.c |
|
|
rename |
db.c |
|
|
renamenx |
db.c |
|
|
expire |
db.c |
设置key的expire时间 |
|
expireat |
db.c |
|
|
keys |
db.c |
|
|
scan |
db.c |
|
|
dbsize |
db.c |
|
|
auth |
redis.c |
|
|
ping |
redis.c |
|
|
echo |
redis.c |
|
|
save |
rdb.c |
|
|
bgsave |
rdb.c |
|
|
bgrewriteeof |
aof.c |
|
|
shutdown |
db.c |
|
|
lastsave |
db.c |
|
|
type |
db.c |
|
|
multi |
multi.c |
事务处理 |
|
exec |
multi.c |
|
|
discard |
multi.c |
|
|
sync |
replication.c |
|
|
psync |
(同sync)Replication.c |
|
|
replconf |
replication.c |
|
|
flushdb |
db.c |
|
|
flushall |
db.c |
|
|
sort |
sort.c |
性能处理函数 |
|
info |
redis.c |
|
|
monitor |
redis.c |
|
|
ttl |
db.c |
|
|
pttl |
pttl.c |
|
|
persist |
db.c |
|
|
slaveof |
replication.c |
|
|
role |
replication.c |
|
|
debug |
debug.c |
|
|
config |
config.c |
|
|
subscribe |
pubsub.c |
发布/订阅模式 |
|
unsubscribe |
pubsub.c |
|
|
psubscribe |
pubsub.c |
|
|
psubscribe |
pubsub.c |
|
|
publish |
pubsub.c |
|
|
pubsub |
pubsub.c |
|
|
watch |
multi.c |
监控一个或多个键直至exec执行 |
|
unwatch |
multi.c |
|
|
restore |
migrate.c |
|
|
migrate |
migrate.c |
|
|
dump |
migrate.c |
|
|
object |
object.c |
|
|
client |
networking.c |
|
|
eval |
scripting.c |
|
|
evalsha |
scripting.c |
|
|
slowlog |
slowlog.c |
|
|
script |
scripting.c |
|
|
time |
redis.c |
|
|
bitop |
bitops.c |
|
|
bitcount |
bitops.c |
|
|
bitops |
bitops.c |
|
|
command |
redis.c |
|
|
pfselftest |
hyperloglog.c |
|
|
pfadd |
hyperloglog.c |
|
|
pfcoount |
hyperloglog.c |
|
|
pfmerge |
hyperloglog.c |
|
|
pfdebug |
hyperloglog.c |
|
|
latency |
latency.c |
本文详细介绍了 Redis 支持的五种数据类型及其对应的命令,包括 string、hash、list、set 和 zset 的基本操作。通过具体的命令解释和应用场景,深入探讨了如何高效地使用 Redis 进行数据存储和检索。
1146

被折叠的 条评论
为什么被折叠?



