Redis4.0、5.0、6.2、7.0标准架构与集群架构均支持 touch、restore、object、unlink、wait、dump、del、scan、exists、expire、expireat、keys、type、move、ttl、persist、pexpire、pexpireat、pttl、randomkey、rename、renamenx、sort 命令。
仅6.2、7.0支持 copy、object help命令。
集群架构跨 Slot 场景,支持 del、exists 命令,不支持 unlink、rename、renamenx。
Redis 7.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 访问的场景。
命令 | 2.8 内存版(标准架构) | 4.0 内存版(标准架构) | 4.0 内存版(集群架构) | 5.0 内存版(标准架构) | 5.0 内存版(集群架构) |
6.2 内存版(标准架构)
|
6.2 内存版(集群架构)
|
7.0 内存版(标准架构)
|
7.0 内存版(集群架构)
| 内存版(集群架构)跨 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 | ✓ | ✓ | - |