docs/ops/API_en.md
Pika supports the interfaces for Redis's five types (string, hash, list, set, zset). Below is a compatibility summary for the five Redis data structures.
| Icon | Meaning |
|---|---|
| o | Fully supported; usage is identical to Redis |
| ! | Functionally supported, but usage or output has some differences from Redis; please note |
| × | Not yet supported |
| Interface | DEL | DUMP | EXISTS | EXPIRE | EXPIREAT | KEYS | MIGRATE | MOVE | OBJECT |
|---|---|---|---|---|---|---|---|---|---|
| Status | o | x | o | o | o | o | x | x | x |
| Interface | PERSIST | PEXPIRE | PEXPIREAT | PTTL | RANDOMKEY | RENAME | RENAMENX | RESTORE | SORT |
| Status | o | ! | ! | o | x | x | x | x | x |
| Interface | TOUCH | TTL | TYPE | UNLINK | WAIT | SCAN | |||
| Status | x | o | ! | o | x | ! |
Notes:
keys * [string, hash, list, zset, set].| Interface | APPEND | BITCOUNT | BITFIELD | BITOP | BITPOS | DECR | DECRBY | GET | GETBIT |
|---|---|---|---|---|---|---|---|---|---|
| Status | o | o | x | ! | o | o | o | o | ! |
| Interface | GETRANGE | GETSET | INCR | INCRBY | INCRBYFLOAT | MGET | MSET | MSETNX | STRLEN |
| Status | o | o | o | o | o | o | o | o | o |
| Interface | PSETEX | SET | SETBIT | SETEX | SETNX | SETRANGE | |||
| Status | o | o | ! | o | o | o |
Notes:
setbit only updates the key's value. But Pika uses RocksDB as the storage engine, which only writes new data and only deletes old data from disk during compaction. If Pika's bit operation range matched Redis's 2^32, each setbit on the same key might store a 512 MB value in RocksDB. This creates a serious performance risk, so Pika's bit operation range has been reduced.| Interface | HDEL | HEXISTS | HGET | HGETALL | HINCRBY | HINCRBYFLOAT | HKEYS | HLEN | HMGET | HMSET |
|---|---|---|---|---|---|---|---|---|---|---|
| Status | o | o | o | o | o | o | o | o | o | o |
| Interface | HSET | HSETNX | HVALS | HSCAN | HSTRLEN | |||||
| Status | ! | o | o | o | o |
Notes:
| Interface | LINDEX | LINSERT | LLEN | LPOP | LPUSH | LPUSHX | LRANGE | LREM | LSET | LTRIM |
|---|---|---|---|---|---|---|---|---|---|---|
| Status | o | o | o | o | o | x | o | o | o | o |
| Interface | RPOP | RPOPLPUSH | RPUSH | RPUSHX | BLPOP | BRPOP | BRPOPLPUSH | |||
| Status | o | o | o | o | o | o | x |
| Interface | SADD | SCARD | SDIFF | SDIFFSTORE | SINTER | SINTERSTORE | SISMEMBER | SMEMBERS | SMOVE | SPOP |
|---|---|---|---|---|---|---|---|---|---|---|
| Status | o | o | o | o | o | o | o | o | o | o |
| Interface | SRANDMEMBER | SREM | SUNION | SUNIONSTORE | SSCAN | |||||
| Status | ! | o | o | o | o |
Notes:
| Interface | ZADD | ZCARD | ZCOUNT | ZINCRBY | ZRANGE | ZRANGEBYSCORE | ZRANK | ZREM | ZREMRANGEBYRANK | ZREMRANGEBYSCORE |
|---|---|---|---|---|---|---|---|---|---|---|
| Status | o | o | o | o | o | o | o | o | o | o |
| Interface | ZREVRANGE | ZREVRANGEBYSCORE | ZREVRANK | ZSCORE | ZUNIONSTORE | ZINTERSTORE | ZSCAN | ZRANGEBYLEX | ZLEXCOUNT | ZREMRANGEBYLEX |
| Status | o | o | o | o | o | o | o | o | o | o |
| Interface | ZPOPMAX | ZPOPMIN | ZREVERANGEBYLEX | |||||||
| Status | o | o | o |
| Interface | PFADD | PFCOUNT | PFMERGE |
|---|---|---|---|
| Status | o | o | o |
Notes:
| Interface | GEOADD | GEODIST | GEOHASH | GEOPOS | GEORADIUS | GEORADIUSBYMEMBER |
|---|---|---|---|---|---|---|
| Status | o | o | o | o | o | o |
| Interface | SETBIT | GETBIT | BITPOS | BITOP | BITCOUNT |
|---|---|---|---|---|---|
| Status | o | o | o | o | o |
| Interface | PSUBSCRIBE | PUBSUB | PUBLISH | PUNSUBSCRIBE | SUBSCRIBE | UNSUBSCRIBE |
|---|---|---|---|---|---|---|
| Status | o | o | o | o | o | o |
Notes:
| Interface | INFO | CONFIG | CLIENT | PING | BGSAVE | SHUTDOWN | SELECT | TYPE | HELLO |
|---|---|---|---|---|---|---|---|---|---|
| Status | ! | o | ! | o | o | o | ! | ! | o |
Notes:
info: Supports full output and pattern-matched output. For example, info stats shows statistics. Note that key space differs from Redis — Pika displays key space by type rather than by DB (since Pika has no concept of databases). Pika's key space statistics are passive and must be manually triggered. Pika's key space statistics are accurate. To trigger: execute keyspace command, then Pika will count in the background. You can use keyspace readonly to view without re-triggering. If current data is 0, it's still being counted. info commandstats can query call count and time statistics (average time) for each command. Unlike Redis, the time unit we use is milliseconds.
client: The current client command supports client list, client kill, and client setname. client list shows less information than Redis.
select: This command had no effect before version 3.1.0; since 3.1.0 it is consistent with Redis.
ping: This command only supports use without parameters, i.e., PING, and the client returns PONG.
Available version: >= 2.3.0
Note: Keyspace notification functionality is not currently supported.
The following Pub/Sub commands are fully compatible with Redis:
For usage details, refer to Redis's Pub/Sub documentation.
Key duplication: Since each Pika type operates independently, duplicate keys are allowed. For example, key abc can exist in both string and hash at the same time. A key can be duplicated at most 5 times (for the 5 major types), but cannot be duplicated within the same interface. Therefore, it is recommended to avoid using exactly the same key across different types.
Multi-DB: Pika supports multiple databases since version 3.1.0. For changes to related commands and parameters, refer to the Pika 3.1.0 multi-DB version command/parameter change reference document.
Data display: Pika displays key space by type rather than by DB (since Pika has no concept of databases). Key statistics in Pika are passive and must be manually triggered; they do not output immediately. The command is: info keyspace [0|1], defaulting to 0 (no trigger). Pika's keyspace statistics are accurate.