- Redis 4.0、5.0、6.2标准架构与集群架构均支持 append、bitcount、bitop、bitpos、decr、decrby、get、getbit、getrange、getset、incr、incrby、incrbyfloat、mget、mset、msetnx、psetex、setex、set、setbit、setnx、setrange、strlen 命令。
- Redis 4.0、5.0均不支持 bitfield_ro、getdel、stralgo 命令。
- 6.2版本支持 bitfield_ro、getdel、stralgo、 getex。
- 集群架构跨 Slot 场景,支持 mget、mset 命令,不支持 bitop、msetnx 命令。
**命令族** **命令** **新增说明** string 族 SET key value [NX \| XX] [GET] [EX seconds \| PX milliseconds \| EXAT unix-time-seconds \| PXAT unix-time-milliseconds \| KEEPTTL] 新增 NX 和 GET 参数。 - NX:表示 Not exists,只有当键不存在时,才会设置键值对。
- GET: 设置新值,返回旧值。
BITPOS key bit [start [end [BYTE \| BIT]]] 新增 BYTE 和 BIT 参数。指定偏移量的单位。BYTE:表示字节偏移,BIT:表示位偏移。默认为 BYTE。 LCS key1 key2 [LEN] [IDX] [MINMATCHLEN min-match-len] [WITHMATCHLEN] - 新增命令。
- 返回两个 key 的最长公共子序列。
各版本支持具体信息,请参见下表。✓ 表示支持,x 表示不支持,- 表示该命令不存在跨 Slot 访问的场景。
| 命令 | 4.0 内存版(标准架构) | 4.0 内存版(集群架构) | 5.0 内存版(标准架构) | 5.0 内存版(集群架构) | 6.2 内存版(标准架构) | 6.2 内存版(集群架构) | 内存版(集群架构)跨 Slot 支持 |
|---|---|---|---|---|---|---|---|
| append | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| bitcount | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| bitop | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | x |
| bitpos | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| decr | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| decrby | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| get | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| getbit | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| getrange | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| getset | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| incr | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| incrby | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| incrbyfloat | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| mget | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| mset | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| msetnx | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | x |
| psetex | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| setex | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| set | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| setbit | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| setnx | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| setrange | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| strlen | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| bitfield | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| bitfield_ro | x | x | x | x | ✓ | ✓ | - |
| stralgo | x | x | x | x | ✓ | ✓ | - |
| getdel | x | x | x | x | ✓ | ✓ | - |
| getex | x | x | x | x | ✓ | ✓ | - |