命令兼容性
最近更新时间: 2025-10-11 18:10:00
各版本命令兼容性说明如下表:
| 命令族 | 命令 | 4.0标准版 | 4.0集群版 | 5.0标准版 | 5.0集群版 | 集群版跨 Slot 支持 |
|---|---|---|---|---|---|---|
| <br>connection 族<br> | auth | ✓ | ✓ | ✓ | ✓ | - |
| echo | ✓ | ✓ | ✓ | ✓ | - | |
| ping | ✓ | ✓ | ✓ | ✓ | - | |
| quit | ✓ | ✓ | ✓ | ✓ | - | |
| select | ✓ | ✓ | ✓ | ✓ | - | |
| swapdb | ✓ | x | ✓ | x | - | |
| <br>hash 族<br> | hdel | ✓ | ✓ | ✓ | ✓ | - |
| hexists | ✓ | ✓ | ✓ | ✓ | - | |
| hget | ✓ | ✓ | ✓ | ✓ | - | |
| hgetall | ✓ | ✓ | ✓ | ✓ | - | |
| hincrby | ✓ | ✓ | ✓ | ✓ | - | |
| hincrbyfloat | ✓ | ✓ | ✓ | ✓ | - | |
| hkeys | ✓ | ✓ | ✓ | ✓ | - | |
| hlen | ✓ | ✓ | ✓ | ✓ | - | |
| hmget | ✓ | ✓ | ✓ | ✓ | - | |
| hmset | > ✓ | ✓ | ✓ | ✓ | - | |
| hset | ✓ | ✓ | ✓ | ✓ | - | |
| hsetnx | ✓ | ✓ | ✓ | ✓ | - | |
| hstrlen | ✓ | ✓ | ✓ | ✓ | - | |
| hvals | ✓ | ✓ | ✓ | ✓ | - | |
| hscan | ✓ | ✓ | ✓ | ✓ | - | |
| touch | ✓ | ✓ | ✓ | ✓ | - | |
| restore | ✓ | ✓ | ✓ | ✓ | - | |
| object | ✓ | ✓ | ✓ | ✓ | - | |
| unlink | ✓ | ✓ | ✓ | ✓ | x | |
| wait | ✓ | x | ✓ | x | - | |
| migrate | x | x | x | x | - | |
| dump | ✓ | ✓ | ✓ | ✓ | - | |
| del | ✓ | ✓ | ✓ | ✓ | ✓ | |
| scan | ✓ | ✓ | ✓ | ✓ | - | |
| exists | ✓ | ✓ | ✓ | ✓ | ✓ | |
| expire | ✓ | ✓ | ✓ | ✓ | - | |
| expireat | ✓ | ✓ | ✓ | ✓ | - | |
| keys | ✓ | ✓ | ✓ | ✓ | - | |
| type | ✓ | ✓ | ✓ | ✓ | - | |
| move | ✓ | ✓ | ✓ | ✓ | - | |
| ttl | ✓ | ✓ | ✓ | ✓ | - | |
| persist | ✓ | ✓ | ✓ | ✓ | - | |
| pexpire | ✓ | ✓ | ✓ | ✓ | - | |
| pexpireat | ✓ | ✓ | ✓ | ✓ | - | |
| pttl | ✓ | ✓ | ✓ | ✓ | - | |
| randomkey | ✓ | ✓ | ✓ | ✓ | - | |
| rename | ✓ | ✓ | ✓ | ✓ | x | |
| renamenx | ✓ | ✓ | ✓ | ✓ | x | |
| sort | ✓ | ✓ | ✓ | ✓ | - | |
| <br>list 族<br> | lindex | ✓ | ✓ | ✓ | ✓ | - |
| linsert | ✓ | ✓ | ✓ | ✓ | - | |
| llen | ✓ | ✓ | ✓ | ✓ | - | |
| lpop | ✓ | ✓ | ✓ | ✓ | - | |
| lpush | ✓ | ✓ | ✓ | ✓ | - | |
| lpushx | ✓ | ✓ | ✓ | ✓ | - | |
| lrange | ✓ | ✓ | ✓ | ✓ | - | |
| lrem | ✓ | ✓ | ✓ | ✓ | - | |
| lset | ✓ | ✓ | ✓ | ✓ | - | |
| ltrim | ✓ | ✓ | ✓ | ✓ | - | |
| rpop | ✓ | ✓ | ✓ | ✓ | - | |
| rpoplpush | ✓ | ✓ | ✓ | ✓ | x | |
| rpush | ✓ | ✓ | ✓ | ✓ | - | |
| rpushx | ✓ | ✓ | ✓ | ✓ | - | |
| blpop | ✓ | ✓ | ✓ | ✓ | x | |
| brpop | ✓ | ✓ | ✓ | ✓ | x | |
| brpoplpush | ✓ | ✓ | ✓ | ✓ | x | |
| <br>pub/sub 族<br> | psubscribe | ✓ | ✓ | ✓ | ✓ | - |
| pubsub | ✓ | ✓ | ✓ | ✓ | - | |
| publish | ✓ | ✓ | ✓ | ✓ | - | |
| punsubscribe | ✓ | ✓ | ✓ | ✓ | - | |
| subscribe | ✓ | ✓ | ✓ | ✓ | - | |
| unsubscribe | ✓ | ✓ | ✓ | ✓ | - | |
| <br>sets 族<br> | sadd | ✓ | ✓ | ✓ | ✓ | - |
| scard | ✓ | ✓ | ✓ | ✓ | - | |
| sdiff | ✓ | ✓ | ✓ | ✓ | x | |
| sdiffstore | ✓ | ✓ | ✓ | ✓ | x | |
| sinter | ✓ | ✓ | ✓ | ✓ | x | |
| sinterstore | ✓ | ✓ | ✓ | ✓ | x | |
| sismember | ✓ | ✓ | ✓ | ✓ | - | |
| smembers | ✓ | ✓ | ✓ | ✓ | - | |
| smove | ✓ | ✓ | ✓ | ✓ | x | |
| spop | ✓ | ✓ | ✓ | ✓ | - | |
| srandmember | ✓ | ✓ | ✓ | ✓ | - | |
| srem | ✓ | ✓ | ✓ | ✓ | - | |
| sscan | ✓ | ✓ | ✓ | ✓ | - | |
| sunion | ✓ | ✓ | ✓ | ✓ | x | |
| sunionstore | ✓ | ✓ | ✓ | ✓ | x | |
| <br>sorted sets 族<br> | zadd | ✓ | ✓ | ✓ | ✓ | - |
| zcard | ✓ | ✓ | ✓ | ✓ | - | |
| zcount | ✓ | ✓ | ✓ | ✓ | - | |
| zincrby | ✓ | ✓ | ✓ | ✓ | - | |
| zinterstore | ✓ | ✓ | ✓ | ✓ | x | |
| zlexcount | ✓ | ✓ | ✓ | ✓ | - | |
| zrange | ✓ | ✓ | ✓ | ✓ | - | |
| zrangebylex | ✓ | ✓ | ✓ | ✓ | - | |
| zrangebyscore | ✓ | ✓ | ✓ | ✓ | - | |
| zrank | ✓ | ✓ | ✓ | ✓ | - | |
| zrem | ✓ | ✓ | ✓ | ✓ | - | |
| zremrangebylex | ✓ | ✓ | ✓ | ✓ | - | |
| zremrangebyrank | ✓ | ✓ | ✓ | ✓ | - | |
| zremrangebyscore | ✓ | ✓ | ✓ | ✓ | - | |
| zrevrange | ✓ | ✓ | ✓ | ✓ | - | |
| zrevrangebylex | ✓ | ✓ | ✓ | ✓ | - | |
| zrevrangebyscore | ✓ | ✓ | ✓ | ✓ | - | |
| zscore | ✓ | ✓ | ✓ | ✓ | - | |
| zrevrank | ✓ | ✓ | ✓ | ✓ | - | |
| zscan | ✓ | ✓ | ✓ | ✓ | - | |
| zunionstore | ✓ | ✓ | ✓ | ✓ | x | |
| <br>zpopmax | x | x | ✓ | ✓ | - | |
| <br>zpopmin | x | x | ✓ | ✓ | - | |
| <br>bzpopmax | x | x | ✓ | ✓ | - | |
| <br>bzpopmin | x | x | ✓ | ✓ | - | |
| <br>strings 族<br> | 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 | ✓ | ✓ | ✓ | ✓ | - | |
| <br>transactions 族<br> | discard | ✓ | ✓ | ✓ | ✓ | - |
| exec | ✓ | ✓ | ✓ | ✓ | - | |
| multi | ✓ | ✓ | ✓ | ✓ | - | |
| unwatch | ✓ | ✓ | ✓ | ✓ | - | |
| watch | ✓ | ✓ | ✓ | ✓ | - | |
| <br>hyperloglog 族<br> | pfadd | ✓ | ✓ | ✓ | ✓ | - |
| pfcount | ✓ | ✓ | ✓ | ✓ | x | |
| pfmerge | ✓ | ✓ | ✓ | ✓ | x | |
| <br>scripting 族<br> | eval | ✓ | ✓ | ✓ | ✓ | x |
| evalsha | ✓ | ✓ | ✓ | ✓ | x | |
| script debug | ✓ | ✓ | ✓ | ✓ | - | |
| script exists | ✓ | ✓ | ✓ | ✓ | x | |
| script flush | ✓ | ✓ | ✓ | ✓ | - | |
| script load | ✓ | ✓ | ✓ | ✓ | - | |
| script kill | ✓ | ✓ | ✓ | ✓ | - | |
| <br>geo 族<br> | geoadd | ✓ | ✓ | ✓ | ✓ | - |
| geohash | ✓ | ✓ | ✓ | ✓ | - | |
| geopos | ✓ | ✓ | ✓ | ✓ | - | |
| geodist | ✓ | ✓ | ✓ | ✓ | - | |
| georadius | ✓ | ✓ | ✓ | ✓ | - | |
| georadiusbymember | ✓ | ✓ | ✓ | ✓ | - | |
| <br>server 族<br> | bgrewriteaof | x | x | x | x | - |
| bgsave | x | x | x | x | - | |
| client kill | x | x | x | x | - | |
| sync | x | x | x | x | - | |
| psync | x | x | x | x | - | |
| client list | ✓ | ✓ | ✓ | ✓ | - | |
| client getname | ✓ | ✓ | ✓ | ✓ | - | |
| client pause | x | x | x | x | - | |
| client reply | x | x | x | x | - | |
| client setname | ✓ | ✓ | ✓ | ✓ | - | |
| command count | ✓ | ✓ | ✓ | ✓ | - | |
| command getkeys | ✓ | ✓ | ✓ | ✓ | - | |
| command info | ✓ | ✓ | ✓ | ✓ | - | |
| slaveof | x | x | x | x | - | |
| config rewrite | <br>✓<br> | <br>✓<br> | <br>✓<br> | <br>✓<br> | - | |
| config set | x | x | x | x | - | |
| config resetstat | <br>✓<br> | <br>✓<br> | <br>✓<br> | <br>✓<br> | - | |
| debug object | x | x | x | x | - | |
| debug segfault | x | x | x | x | - | |
| role | ✓ | ✓ | ✓ | ✓ | - | |
| save | x | x | x | x | - | |
| lastsave | ✓ | ✓ | ✓ | ✓ | - | |
| shutdown | x | x | x | x | - | |
| MEMORY | ✓ | x | ✓ | x | - | |
| command | ✓ | ✓ | ✓ | ✓ | - | |
| dbsize | ✓ | ✓ | ✓ | ✓ | - | |
| info | ✓ | ✓ | ✓ | ✓ | - | |
| time | ✓ | ✓ | ✓ | ✓ | - | |
| config get | ✓ | ✓ | ✓ | ✓ | - | |
| monitor | ✓ | ✓ | ✓ | ✓ | - | |
| flushdb | ✓ | ✓ | ✓ | ✓ | - | |
| flushall | ✓ | ✓ | ✓ | ✓ | - | |
| slowlog | ✓ | x | ✓ | x | - | |
| cluster keyslot | x | ✓ | x | ✓ | - | |
| cluster nodes | x | ✓ | x | ✓ | - | |
| cluster getkeysinslot | x | ✓ | x | ✓ | - | |
| cluster slots | x | ✓ | x | ✓ | - | |
| cluster info | x | ✓ | x | ✓ | - | |
| cluster countkeysinslot | x | ✓ | x | ✓ | - | |
| cluster 其他 | x | x | x | x | - | |
| module | x | x | x | x | - | |
| lolwut | x | x | ✓ | ✓ | - | |
| <br>Stream 族<br> | xinfo | x | x | ✓ | ✓ | - |
| xadd | x | x | ✓ | ✓ | - | |
| xtrim | x | x | ✓ | ✓ | - | |
| xdel | x | x | ✓ | ✓ | - | |
| xrange | x | x | ✓ | ✓ | - | |
| xrevrange | x | x | ✓ | ✓ | - | |
| xlen | x | x | ✓ | ✓ | - | |
| xread | x | x | ✓ | ✓ | x | |
| xgroup | x | x | ✓ | ✓ | - | |
| xreadgroup | x | x | ✓ | ✓ | x | |
| xack | x | x | ✓ | ✓ | - | |
| xclaim | x | x | ✓ | ✓ | - | |
| xpending | x | x | ✓ | ✓ | - |