Redis 4.0、5.0、6.2、7.0、ValKey 8.0标准架构与集群架构均支持 touch、restore、object、unlink、wait、dump、del、scan、exists、expire、expireat、keys、type、move、ttl、persist、pexpire、pexpireat、pttl、randomkey、rename、renamenx、sort 命令。
仅 Redis 6.2、7.0,及其 ValKey 8.0支持 copy、object help 命令。
集群架构跨 Slot 场景,支持 del、exists 命令,不支持 unlink、rename、renamenx。
Redis 7.0版本,及其 ValKey 8.0支持:sort_ro、expiretime、pexpiretime。
命令族 | 命令 | 新增说明 |
keys 族 | EXPIRETIME key | 新增命令。 返回 key 过期时间的秒级时间戳。 |
| PEXPIRETIME key | 新增命令。 返回 key 过期时间的毫秒级时间戳。 |
| EXPIRE key seconds [NX | XX | GT | LT] | 新增 NX | XX | GT | LT参数。 NX 只当 key 不存在过期时间的时候,设置过期时间。 XX 只当 key 存在过期时间的时候,设置过期时间。 GT 只当新的过期时间比当前过期时间更大的时候,设置新的过期时间。 LT 只当新的过期时间比当前过期时间更小的时候,设置新的过期时间。 |
| SORT_RO key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC | DESC] [ALPHA] | 新增命令。 对 Redis 中的有序集合(sorted set)进行排序并获取排序后的结果。 |
具体信息,请参见下表。✓ 表示支持,x 表示不支持,- 表示该命令不存在跨 Slot 访问的场景。
命令 | Redis 7.0/ValKey 8.0 标准架构 | Redis 7.0/ValKey 8.0 集群架构 | Redis 6.2标准架构 | Redis 6.2集群架构 | Redis 5.0标准架构 | Redis 5.0集群架构 | Redis 4.0标准架构 | Redis 4.0集群架构 | Redis 2.8标准架构 | 集群架构跨 Slot 支持 |
touch | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | x | - |
restore | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
object | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
object help | ✓ | ✓ | ✓ | ✓ | x | x | x | x | x | - |
unlink | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | x | x |
wait | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | x | - |
migrate | x | x | x | x | x | x | x | x | x | - |
dump | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
del | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
scan | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
exists | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
expire | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
expireat | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
keys | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
type | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
move | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
ttl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
persist | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
pexpire | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
pexpireat | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
pttl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
randomkey | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
rename | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | x |
renamenx | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | x |
sort | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
sort_ro | ✓ | ✓ | x | x | x | x | x | x | x | - |
copy | ✓ | ✓ | ✓ | ✓ | x | x | x | x | x | - |
expiretime | ✓ | ✓ | x | x | x | x | x | x | x | - |
pexpiretime | ✓ | ✓ | x | x | x | x | x | x | x | - |