Supported Commands
Hint
This article is generated by AI translation.
- Update count: Use executeUpdate / getUpdateCount to get the number of affected rows.
- Result set: Use executeQuery / getResultSet to get the result set.
Hash Command Set
| Command | Return | Rows | Result |
|---|---|---|---|
| HDEL | Value | -- | Number of fields deleted from the hash, not including non-existing fields. Returns 0 if the key does not exist. |
| HEXISTS | ResultSet | 1 | RESULT field, BOOLEAN type |
| HEXPIRE | ResultSet | multiple | RESULT field, LONG type |
| HEXPIREAT | ResultSet | multiple | RESULT field, LONG type |
| HEXPIRETIME | ResultSet | multiple | RESULT field, LONG type |
| HPEXPIRE | ResultSet | multiple | RESULT field, LONG type |
| HPEXPIREAT | ResultSet | multiple | RESULT field, LONG type |
| HPEXPIRETIME | ResultSet | multiple | RESULT field, LONG type |
| HGET | ResultSet | 1 | VALUE field, STRING type |
| HGETALL | ResultSet | multiple | FIELD field, STRING type VALUE field, STRING type |
| HINCRBY | ResultSet | 1 | VALUE field, LONG type |
| HKEYS | ResultSet | multiple | FIELD field, STRING type |
| HLEN | ResultSet | 1 | RESULT field, LONG type |
| HMGET | ResultSet | multiple | VALUE field, STRING type |
| HSET | Value | -- | Number of fields added. |
| HMSET | Value | -- | Number of fields added. |
| HSETNX | Value | -- | Returns 0 if the field already exists; returns 1 if a new field was created. |
| HPERSIST | ResultSet | multiple | RESULT field, LONG type |
| HTTL | ResultSet | multiple | RESULT field, LONG type |
| HPTTL | ResultSet | multiple | RESULT field, LONG type |
| HRANDFIELD | ResultSet | multiple | FIELD field, STRING type VALUE field, STRING type (when using WITHVALUES) |
| HSCAN | ResultSet | multiple | CURSOR field, STRING type FIELD field, STRING type VALUE field, STRING type (when not using NOVALUES) |
| HSTRLEN | ResultSet | 1 | RESULT field, LONG type |
| HVALS | ResultSet | multiple | VALUE field, STRING type |
Keys Command Set
| Command | Return | Rows | Result |
|---|---|---|---|
| COPY | Value | -- | 1 if successful; 0 if failed |
| DEL | Value | -- | Integer > 0 if one or more keys removed; 0 if none of the specified keys exist |
| UNLINK | ResultSet | 1 | RESULT field, LONG type |
| DUMP | ResultSet | 1 | VALUE field, BYTES type |
| EXISTS | ResultSet | 1 | RESULT field, LONG type |
| EXPIRE | Value | -- | 1 if timeout was set; 0 otherwise. |
| EXPIREAT | Value | -- | 1 if timeout was set; 0 otherwise. |
| EXPIRETIME | ResultSet | 1 | RESULT field, LONG type |
| PEXPIRE | Value | -- | 1 if timeout was set; 0 otherwise. |
| PEXPIREAT | Value | -- | 1 if timeout was set; 0 otherwise. |
| PEXPIRETIME | ResultSet | 1 | RESULT field, LONG type |
| KEYS | ResultSet | multiple | KEY field, STRING type (Note: the driver uses the scan command instead of the keys command) |
| OBJECT ENCODING | ResultSet | 1 | RESULT field, STRING type |
| OBJECT FREQ | ResultSet | 1 | RESULT field, LONG type |
| OBJECT IDLETIME | ResultSet | 1 | RESULT field, LONG type |
| OBJECT REFCOUNT | ResultSet | 1 | RESULT field, LONG type |
| PERSIST | Value | -- | 1 if the key currently has a timeout set; 0 otherwise |
| TTL | ResultSet | 1 | RESULT field, LONG type |
| PTTL | ResultSet | 1 | RESULT field, LONG type |
| RANDOMKEY | ResultSet | 1 | KEY field, STRING type |
| RENAME | Value | -- | 1 if key was renamed; 0 if target key already exists. (Determined by OK status code) |
| RENAMENX | Value | -- | 1 if key was renamed; 0 if target key already exists. |
| SCAN | ResultSet | multiple | CURSOR field, STRING type KEY field, STRING type |
| TOUCH | Value | -- | Number of keys that were TOUCHed. |
| TYPE | ResultSet | 1 | RESULT field, STRING type |
List Command Set
| Command | Return | Rows | Result |
|---|---|---|---|
| LMOVE | ResultSet | 1 | ELEMENT field, STRING type |
| BLMOVE | ResultSet | 1 | ELEMENT field, STRING type |
| LMPOP | ResultSet | multiple | KEY field, STRING type (returns Key from Key,ValueList structure) ELEMENT field, STRING type |
| BLMPOP | ResultSet | multiple | KEY field, STRING type (returns Key from Key,ValueList structure) ELEMENT field, STRING type |
| LPOP | ResultSet | multiple | ELEMENT field, STRING type |
| RPOP | ResultSet | multiple | ELEMENT field, STRING type |
| BLPOP | ResultSet | multiple | ELEMENT field, STRING type |
| BRPOP | ResultSet | multiple | ELEMENT field, STRING type |
| RPOPLPUSH | ResultSet | 1 | ELEMENT field, STRING type |
| BRPOPLPUSH | ResultSet | 1 | ELEMENT field, STRING type |
| LINDEX | ResultSet | 1 | ELEMENT field, STRING type |
| LINSERT | Value | -- | Length of the list after insert; returns 0 when key doesn't exist; returns -1 when pivot not found. |
| LLEN | ResultSet | 1 | RESULT field, LONG type |
| LPOS | ResultSet | multiple | RESULT field, LONG type |
| LPUSH | Value | -- | Length of the list after the PUSH operation. |
| LPUSHX | Value | -- | Length of the list after the PUSH operation. |
| RPUSH | Value | -- | Length of the list after the PUSH operation. |
| RPUSHX | Value | -- | Length of the list after the PUSH operation. |
| LRANGE | ResultSet | multiple | ELEMENT field, STRING type |
| LREM | Value | -- | Number of removed elements. |
| LSET | Value | -- | 1 if successful, 0 otherwise. (Success when status is "OK") |
| LTRIM | Value | -- | 1 if successful, 0 otherwise. (Success when status is "OK") |
Server Command Set
| Command | Return | Rows | Result |
|---|---|---|---|
| MOVE | Value | -- | 1 if key was moved; 0 otherwise |
| WAIT | ResultSet | 1 | REPLICAS field, LONG type |
| WAITAOF | ResultSet | 1 | LOCAL field, LONG type REPLICAS field, LONG type |
| PING | ResultSet | 1 | RESULT field, STRING type |
| ECHO | ResultSet | 1 | RESULT field, STRING type |
| SELECT | Value | -- | Returns 1 on success; throws exception otherwise |
Set Command Set
| Command | Return | Rows | Result |
|---|---|---|---|
| SADD | Value | -- | Number of elements added to the set, not including elements already present. |
| SCARD | ResultSet | 1 | RESULT field, LONG type |
| SDIFF | ResultSet | multiple | ELEMENT field, STRING type |
| SDIFFSTORE | Value | -- | Number of elements in the resulting set. |
| SINTER | ResultSet | multiple | ELEMENT field, STRING type |
| SINTERCARD | ResultSet | 1 | RESULT field, LONG type |
| SINTERSTORE | Value | -- | Number of elements in the resulting set. |
| SISMEMBER | ResultSet | 1 | RESULT field, LONG type |
| SMISMEMBER | ResultSet | multiple | RESULT field, BOOLEAN type |
| SMEMBERS | ResultSet | multiple | ELEMENT field, STRING type |
| SMOVE | Value | -- | 1 if element was moved; 0 otherwise |
| SPOP | ResultSet | multiple | ELEMENT field, STRING type |
| SRANDMEMBER | ResultSet | multiple | ELEMENT field, STRING type |
| SREM | Value | -- | Number of members removed from the set, not including non-existing members. |
| SSCAN | ResultSet | multiple | CURSOR field, STRING type ELEMENT field, STRING type |
| SUNION | ResultSet | multiple | ELEMENT field, STRING type |
| SUNIONSTORE | Value | -- | Number of elements in the resulting set. |
SortedSet Command Set
| Command | Return | Rows | Result |
|---|---|---|---|
| ZMPOP | ResultSet | multiple | KEY field, STRING type ELEMENT field, STRING type SCORE field, DOUBLE type |
| BZMPOP | ResultSet | multiple | KEY field, STRING type ELEMENT field, STRING type SCORE field, DOUBLE type |
| ZPOPMAX | ResultSet | multiple | ELEMENT field, STRING type SCORE field, DOUBLE type |
| BZPOPMAX | ResultSet | 1 | KEY field, STRING type ELEMENT field, STRING type SCORE field, DOUBLE type |
| ZPOPMIN | ResultSet | multiple | ELEMENT field, STRING type SCORE field, DOUBLE type |
| BZPOPMIN | ResultSet | 1 | KEY field, STRING type ELEMENT field, STRING type SCORE field, DOUBLE type |
| ZADD | ResultSet | 1 | RESULT field, DOUBLE type (when using INCR) RESULT field, LONG type (when not using INCR) |
| ZCARD | ResultSet | 1 | RESULT field, LONG type |
| ZCOUNT | ResultSet | 1 | RESULT field, LONG type |
| ZDIFF | ResultSet | multiple | ELEMENT field, STRING type SCORE field, DOUBLE type (when using WITHSCORES) |
| ZDIFFSTORE | Value | -- | Number of elements in the resulting sorted set. |
| ZINCRBY | ResultSet | 1 | SCORE field, DOUBLE type |
| ZINTER | ResultSet | multiple | ELEMENT field, STRING type SCORE field, DOUBLE type (when using WITHSCORES) |
| ZINTERCARD | ResultSet | 1 | RESULT field, LONG type |
| ZINTERSTORE | Value | -- | Number of elements in the resulting sorted set. |
| ZLEXCOUNT | ResultSet | 1 | RESULT field, LONG type |
| ZSCORE | ResultSet | 1 | SCORE field, DOUBLE type |
| ZMSCORE | ResultSet | multiple | SCORE field, DOUBLE type |
| ZRANDMEMBER | ResultSet | multiple | ELEMENT field, STRING type SCORE field, DOUBLE type (when using WITHSCORES) |
| ZRANGE | ResultSet | multiple | ELEMENT field, STRING type SCORE field, DOUBLE type (when using WITHSCORES) |
| ZRANGEBYLEX | ResultSet | multiple | ELEMENT field, STRING type |
| ZRANGEBYSCORE | ResultSet | multiple | ELEMENT field, STRING type SCORE field, DOUBLE type (when using WITHSCORES) |
| ZRANGESTORE | Value | -- | Number of elements in the resulting sorted set. |
| ZRANK | ResultSet | 1 | SCORE field, DOUBLE type (when using WITHSCORES) RANK field, LONG type |
| ZREVRANK | ResultSet | 1 | SCORE field, DOUBLE type (when using WITHSCORES) RANK field, LONG type |
| ZREM | Value | -- | Number of members removed from the sorted set, not including non-existing members. |
| ZREMRANGEBYLEX | Value | -- | Number of members removed from the sorted set, not including non-existing members. |
| ZREMRANGEBYRANK | Value | -- | Number of members removed from the sorted set, not including non-existing members. |
| ZREMRANGEBYSCORE | Value | -- | Number of members removed from the sorted set, not including non-existing members. |
| ZREVRANGE | ResultSet | multiple | ELEMENT field, STRING type SCORE field, DOUBLE type (when using WITHSCORES) |
| ZREVRANGEBYLEX | ResultSet | multiple | ELEMENT field, STRING type |
| ZREVRANGEBYSCORE | ResultSet | multiple | ELEMENT field, STRING type SCORE field, DOUBLE type (when using WITHSCORES) |
| ZSCAN | ResultSet | multiple | CURSOR field, STRING type ELEMENT field, STRING type SCORE field, DOUBLE type |
| ZUNION | ResultSet | multiple | ELEMENT field, STRING type SCORE field, DOUBLE type (when using WITHSCORES) |
| ZUNIONSTORE | Value | -- | Number of elements in the resulting sorted set. |
String Command Set
| Command | Return | Rows | Result |
|---|---|---|---|
| SET | Value/ResultSet | --/1 | Value: When not using GET, returns 0 (not set) or 1 (set successfully) ResultSet: When using GET, VALUE field, STRING type |
| GET | ResultSet | 1 | VALUE field, STRING type |
| INCR | ResultSet | 1 | VALUE field, LONG type |
| INCRBY | ResultSet | 1 | VALUE field, LONG type |
| DECR | ResultSet | 1 | VALUE field, LONG type |
| DECRBY | ResultSet | 1 | VALUE field, LONG type |
| APPEND | ResultSet | 1 | RESULT field, LONG type |
| GETDEL | ResultSet | 1 | VALUE field, STRING type |
| GETEX | ResultSet | 1 | VALUE field, STRING type |
| GETRANGE | ResultSet | 1 | VALUE field, STRING type |
| GETSET | ResultSet | 1 | VALUE field, STRING type |
| MGET | ResultSet | multiple | KEY field, STRING type VALUE field, STRING type |
| MSET | Value | -- | Number of keys added. |
| MSETNX | Value | -- | Returns 0 if no keys were set (at least one key already exists); returns the number of keys if all keys were set. |
| PSETEX | Value | -- | Returns 1 if successful; 0 otherwise. (Success when status is "OK") |
| SETEX | Value | -- | Returns 1 if successful; 0 otherwise. (Success when status is "OK") |
| SETNX | Value | -- | 1 if key was set; 0 otherwise |
| SETRANGE | Value | -- | Length of the string after modification. |
| STRLEN | ResultSet | 1 | RESULT field, LONG type |
| SUBSTR | ResultSet | 1 | VALUE field, STRING type |