pub enum Command {
Show 199 variants
Ping(Option<Bytes>),
Echo(Bytes),
Get {
key: String,
},
Set {
key: String,
value: Bytes,
expire: Option<SetExpire>,
nx: bool,
xx: bool,
},
Incr {
key: String,
},
Decr {
key: String,
},
IncrBy {
key: String,
delta: i64,
},
DecrBy {
key: String,
delta: i64,
},
IncrByFloat {
key: String,
delta: f64,
},
Append {
key: String,
value: Bytes,
},
Strlen {
key: String,
},
GetRange {
key: String,
start: i64,
end: i64,
},
SetRange {
key: String,
offset: usize,
value: Bytes,
},
GetBit {
key: String,
offset: u64,
},
SetBit {
key: String,
offset: u64,
value: u8,
},
BitCount {
key: String,
range: Option<BitRange>,
},
BitPos {
key: String,
bit: u8,
range: Option<BitRange>,
},
BitOp {
op: BitOpKind,
dest: String,
keys: Vec<String>,
},
Keys {
pattern: String,
},
Rename {
key: String,
newkey: String,
},
Del {
keys: Vec<String>,
},
Unlink {
keys: Vec<String>,
},
Exists {
keys: Vec<String>,
},
MGet {
keys: Vec<String>,
},
MSet {
pairs: Vec<(String, Bytes)>,
},
MSetNx {
pairs: Vec<(String, Bytes)>,
},
GetSet {
key: String,
value: Bytes,
},
Expire {
key: String,
seconds: u64,
},
Expireat {
key: String,
timestamp: u64,
},
Ttl {
key: String,
},
Persist {
key: String,
},
Pttl {
key: String,
},
Pexpire {
key: String,
milliseconds: u64,
},
Pexpireat {
key: String,
timestamp_ms: u64,
},
DbSize,
Info {
section: Option<String>,
},
BgSave,
BgRewriteAof,
FlushDb {
async_mode: bool,
},
FlushAll {
async_mode: bool,
},
MemoryUsage {
key: String,
},
ConfigGet {
pattern: String,
},
ConfigSet {
param: String,
value: String,
},
ConfigRewrite,
Multi,
Exec,
Discard,
Scan {
cursor: u64,
pattern: Option<String>,
count: Option<usize>,
},
SScan {
key: String,
cursor: u64,
pattern: Option<String>,
count: Option<usize>,
},
HScan {
key: String,
cursor: u64,
pattern: Option<String>,
count: Option<usize>,
},
ZScan {
key: String,
cursor: u64,
pattern: Option<String>,
count: Option<usize>,
},
LPush {
key: String,
values: Vec<Bytes>,
},
RPush {
key: String,
values: Vec<Bytes>,
},
LPop {
key: String,
count: Option<usize>,
},
RPop {
key: String,
count: Option<usize>,
},
LRange {
key: String,
start: i64,
stop: i64,
},
LLen {
key: String,
},
BLPop {
keys: Vec<String>,
timeout_secs: f64,
},
BRPop {
keys: Vec<String>,
timeout_secs: f64,
},
LIndex {
key: String,
index: i64,
},
LSet {
key: String,
index: i64,
value: Bytes,
},
LTrim {
key: String,
start: i64,
stop: i64,
},
LInsert {
key: String,
before: bool,
pivot: Bytes,
value: Bytes,
},
LRem {
key: String,
count: i64,
value: Bytes,
},
LPos {
key: String,
element: Bytes,
rank: i64,
count: Option<usize>,
maxlen: usize,
},
LMove {
source: String,
destination: String,
src_left: bool,
dst_left: bool,
},
GetDel {
key: String,
},
GetEx {
key: String,
expire: Option<Option<SetExpire>>,
},
ZDiff {
keys: Vec<String>,
with_scores: bool,
},
ZInter {
keys: Vec<String>,
with_scores: bool,
},
ZUnion {
keys: Vec<String>,
with_scores: bool,
},
ZDiffStore {
dest: String,
keys: Vec<String>,
},
ZInterStore {
dest: String,
keys: Vec<String>,
},
ZUnionStore {
dest: String,
keys: Vec<String>,
},
Type {
key: String,
},
ZAdd {
key: String,
flags: ZAddFlags,
members: Vec<(f64, String)>,
},
ZRem {
key: String,
members: Vec<String>,
},
ZScore {
key: String,
member: String,
},
ZRank {
key: String,
member: String,
},
ZCard {
key: String,
},
ZRange {
key: String,
start: i64,
stop: i64,
with_scores: bool,
},
ZRevRange {
key: String,
start: i64,
stop: i64,
with_scores: bool,
},
ZRevRank {
key: String,
member: String,
},
ZCount {
key: String,
min: ScoreBound,
max: ScoreBound,
},
ZIncrBy {
key: String,
increment: f64,
member: String,
},
ZRangeByScore {
key: String,
min: ScoreBound,
max: ScoreBound,
with_scores: bool,
offset: usize,
count: Option<usize>,
},
ZRevRangeByScore {
key: String,
min: ScoreBound,
max: ScoreBound,
with_scores: bool,
offset: usize,
count: Option<usize>,
},
ZPopMin {
key: String,
count: usize,
},
ZPopMax {
key: String,
count: usize,
},
Lmpop {
keys: Vec<String>,
left: bool,
count: usize,
},
Zmpop {
keys: Vec<String>,
min: bool,
count: usize,
},
HSet {
key: String,
fields: Vec<(String, Bytes)>,
},
HGet {
key: String,
field: String,
},
HGetAll {
key: String,
},
HDel {
key: String,
fields: Vec<String>,
},
HExists {
key: String,
field: String,
},
HLen {
key: String,
},
HIncrBy {
key: String,
field: String,
delta: i64,
},
HKeys {
key: String,
},
HVals {
key: String,
},
HMGet {
key: String,
fields: Vec<String>,
},
HRandField {
key: String,
count: Option<i64>,
with_values: bool,
},
SAdd {
key: String,
members: Vec<String>,
},
SRem {
key: String,
members: Vec<String>,
},
SMembers {
key: String,
},
SIsMember {
key: String,
member: String,
},
SCard {
key: String,
},
SUnion {
keys: Vec<String>,
},
SInter {
keys: Vec<String>,
},
SDiff {
keys: Vec<String>,
},
SUnionStore {
dest: String,
keys: Vec<String>,
},
SInterStore {
dest: String,
keys: Vec<String>,
},
SDiffStore {
dest: String,
keys: Vec<String>,
},
SRandMember {
key: String,
count: Option<i64>,
},
ZRandMember {
key: String,
count: Option<i64>,
with_scores: bool,
},
SPop {
key: String,
count: usize,
},
SMisMember {
key: String,
members: Vec<String>,
},
SMove {
source: String,
destination: String,
member: String,
},
SInterCard {
keys: Vec<String>,
limit: usize,
},
Expiretime {
key: String,
},
Pexpiretime {
key: String,
},
ClusterInfo,
ClusterNodes,
ClusterSlots,
ClusterKeySlot {
key: String,
},
ClusterMyId,
ClusterSetSlotImporting {
slot: u16,
node_id: String,
},
ClusterSetSlotMigrating {
slot: u16,
node_id: String,
},
ClusterSetSlotNode {
slot: u16,
node_id: String,
},
ClusterSetSlotStable {
slot: u16,
},
ClusterMeet {
ip: String,
port: u16,
},
ClusterAddSlots {
slots: Vec<u16>,
},
ClusterAddSlotsRange {
ranges: Vec<(u16, u16)>,
},
ClusterDelSlots {
slots: Vec<u16>,
},
ClusterForget {
node_id: String,
},
ClusterReplicate {
node_id: String,
},
ClusterFailover {
force: bool,
takeover: bool,
},
ClusterCountKeysInSlot {
slot: u16,
},
ClusterGetKeysInSlot {
slot: u16,
count: u32,
},
Migrate {
host: String,
port: u16,
key: String,
db: u32,
timeout_ms: u64,
copy: bool,
replace: bool,
},
Restore {
key: String,
ttl_ms: u64,
data: Bytes,
replace: bool,
},
Asking,
SlowLogGet {
count: Option<usize>,
},
SlowLogLen,
SlowLogReset,
Subscribe {
channels: Vec<String>,
},
Unsubscribe {
channels: Vec<String>,
},
PSubscribe {
patterns: Vec<String>,
},
PUnsubscribe {
patterns: Vec<String>,
},
Publish {
channel: String,
message: Bytes,
},
PubSubChannels {
pattern: Option<String>,
},
PubSubNumSub {
channels: Vec<String>,
},
PubSubNumPat,
VAdd {
key: String,
element: String,
vector: Vec<f32>,
metric: u8,
quantization: u8,
connectivity: u32,
expansion_add: u32,
},
VAddBatch {
key: String,
entries: Vec<(String, Vec<f32>)>,
dim: usize,
metric: u8,
quantization: u8,
connectivity: u32,
expansion_add: u32,
},
VSim {
key: String,
query: Vec<f32>,
count: usize,
ef_search: usize,
with_scores: bool,
},
VRem {
key: String,
element: String,
},
VGet {
key: String,
element: String,
},
VCard {
key: String,
},
VDim {
key: String,
},
VInfo {
key: String,
},
ProtoRegister {
name: String,
descriptor: Bytes,
},
ProtoSet {
key: String,
type_name: String,
data: Bytes,
expire: Option<SetExpire>,
nx: bool,
xx: bool,
},
ProtoGet {
key: String,
},
ProtoType {
key: String,
},
ProtoSchemas,
ProtoDescribe {
name: String,
},
ProtoGetField {
key: String,
field_path: String,
},
ProtoSetField {
key: String,
field_path: String,
value: String,
},
ProtoDelField {
key: String,
field_path: String,
},
ClientId,
ClientSetName {
name: String,
},
ClientGetName,
ClientList,
Auth {
username: Option<String>,
password: String,
},
AclWhoAmI,
AclList,
AclUsers,
AclGetUser {
username: String,
},
AclDelUser {
usernames: Vec<String>,
},
AclSetUser {
username: String,
rules: Vec<String>,
},
AclCat {
category: Option<String>,
},
Watch {
keys: Vec<String>,
},
Unwatch,
Time,
LastSave,
Role,
Wait {
numreplicas: u64,
timeout_ms: u64,
},
ObjectEncoding {
key: String,
},
ObjectRefcount {
key: String,
},
Copy {
source: String,
destination: String,
replace: bool,
},
Quit,
Monitor,
RandomKey,
Touch {
keys: Vec<String>,
},
Sort {
key: String,
desc: bool,
alpha: bool,
limit: Option<(i64, i64)>,
store: Option<String>,
},
Command {
subcommand: Option<String>,
args: Vec<String>,
},
HIncrByFloat {
key: String,
field: String,
delta: f64,
},
Unknown(String),
}Expand description
A parsed client command, ready for execution.
Variants§
Ping(Option<Bytes>)
PING with an optional message. Returns PONG or echoes the message.
Echo(Bytes)
ECHO message. Returns the message back to the client.
Get
GET key. Returns the value or nil.
Set
SET key value [EX seconds | PX milliseconds] [NX | XX].
Fields
Incr
INCR key. Increments the integer value of a key by 1.
Decr
DECR key. Decrements the integer value of a key by 1.
IncrBy
INCRBY key increment. Increments the integer value of a key by the given amount.
DecrBy
DECRBY key decrement. Decrements the integer value of a key by the given amount.
IncrByFloat
INCRBYFLOAT key increment. Increments the float value of a key by the given amount.
Append
APPEND key value. Appends a value to a string key. Returns the new length.
Strlen
STRLEN key. Returns the length of the string value stored at key.
GetRange
GETRANGE key start end. Returns a substring of the string at key.
SetRange
SETRANGE key offset value. Overwrites part of the string at key.
GetBit
GETBIT key offset. Returns the bit at offset in the string stored at key.
Bit ordering is big-endian (Redis compatible): byte 0 holds bits 0–7, MSB first. Returns 0 if the key does not exist.
SetBit
SETBIT key offset value. Sets or clears the bit at offset.
The string is automatically grown to accommodate the offset. Returns the original bit value.
BitCount
BITCOUNT key [start end [BYTE|BIT]]. Counts set bits in the string,
optionally restricted to a byte or bit range.
BitPos
BITPOS key bit [start [end [BYTE|BIT]]]. Returns the position of the
first set (bit=1) or clear (bit=0) bit in the string.
BitOp
BITOP operation destkey key [key …]. Performs a bitwise operation
across source strings and stores the result in destkey.
Keys
KEYS pattern. Returns all keys matching a glob pattern.
Rename
RENAME key newkey. Renames a key.
Del
DEL key [key …]. Returns the number of keys removed.
Unlink
UNLINK key [key …]. Like DEL but frees memory in the background.
Exists
EXISTS key [key …]. Returns the number of keys that exist.
MGet
MGET key [key …]. Returns the values for all specified keys.
MSet
MSET key value [key value …]. Sets multiple key-value pairs.
MSetNx
MSETNX key value [key value …]. Sets multiple keys only if none already exist.
Returns 1 if all keys were set, 0 if any key already existed (atomic: all-or-nothing).
GetSet
GETSET key value. Atomically sets key to value and returns the old value.
Deprecated in Redis 6.2 but widely used; kept for compatibility.
Expire
EXPIRE key seconds. Sets a TTL on an existing key.
Expireat
EXPIREAT key timestamp. Sets expiry at an absolute Unix timestamp (seconds).
Ttl
TTL key. Returns remaining time-to-live in seconds.
Persist
PERSIST key. Removes the expiration from a key.
Pttl
PTTL key. Returns remaining time-to-live in milliseconds.
Pexpire
PEXPIRE key milliseconds. Sets a TTL in milliseconds on an existing key.
Pexpireat
PEXPIREAT key timestamp-ms. Sets expiry at an absolute Unix timestamp (milliseconds).
DbSize
DBSIZE. Returns the number of keys in the database.
Info
INFO [section]. Returns server info. Currently only supports “keyspace”.
BgSave
BGSAVE. Triggers a background snapshot.
BgRewriteAof
BGREWRITEAOF. Triggers an AOF rewrite (snapshot + truncate).
FlushDb
FLUSHDB [ASYNC]. Removes all keys from the database.
FlushAll
FLUSHALL [ASYNC]. Removes all keys (alias for FLUSHDB — Ember is single-database).
MemoryUsage
MEMORY USAGE key [SAMPLES count]. Returns estimated memory usage in bytes.
ConfigGet
CONFIG GET pattern. Returns matching server configuration parameters.
ConfigSet
CONFIG SET param value. Sets a server configuration parameter at runtime.
ConfigRewrite
CONFIG REWRITE. Writes the current config to the file loaded at startup.
Multi
MULTI. Starts a transaction — subsequent commands are queued until EXEC.
Exec
EXEC. Executes all queued commands atomically, returning an array of results.
Discard
DISCARD. Aborts a transaction, discarding all queued commands.
Scan
SCAN cursor [MATCH pattern] [COUNT count]. Iterates keys.
SScan
SSCAN key cursor [MATCH pattern] [COUNT count]. Iterates set members.
HScan
HSCAN key cursor [MATCH pattern] [COUNT count]. Iterates hash fields.
ZScan
ZSCAN key cursor [MATCH pattern] [COUNT count]. Iterates sorted set members.
LPush
LPUSH key value [value …]. Pushes values to the head of a list.
RPush
RPUSH key value [value …]. Pushes values to the tail of a list.
LPop
LPOP key [count]. Pops one or more values from the head of a list.
Without count: returns a bulk string (or nil). With count: returns
an array of up to count elements (Redis 6.2+ semantics).
RPop
RPOP key [count]. Pops one or more values from the tail of a list.
Without count: returns a bulk string (or nil). With count: returns
an array of up to count elements (Redis 6.2+ semantics).
LRange
LRANGE key start stop. Returns a range of elements by index.
LLen
LLEN key. Returns the length of a list.
BLPop
BLPOP key [key …] timeout. Blocks until an element is available
at the head of one of the given lists, or the timeout expires.
BRPop
BRPOP key [key …] timeout. Blocks until an element is available
at the tail of one of the given lists, or the timeout expires.
LIndex
LINDEX key index. Returns the element at index in the list.
LSet
LSET key index element. Sets the element at index.
LTrim
LTRIM key start stop. Trims the list to the specified range.
LInsert
LINSERT key BEFORE|AFTER pivot element. Inserts before or after pivot.
LRem
LREM key count element. Removes elements equal to value.
LPos
LPOS key element [RANK rank] [COUNT count] [MAXLEN maxlen].
LMove
LMOVE source destination LEFT|RIGHT LEFT|RIGHT.
Atomically pops from the source list and pushes to the destination list.
Fields
GetDel
GETDEL key. Returns the value of a key and deletes it atomically.
GetEx
GETEX key [EX seconds | PX ms | EXAT timestamp | PXAT timestamp-ms | PERSIST].
Returns the value of a key and optionally updates its expiry.
Fields
ZDiff
ZDIFF numkeys key [key …] [WITHSCORES].
Returns members in the first sorted set not present in the others.
ZInter
ZINTER numkeys key [key …] [WITHSCORES].
Returns members present in all of the given sorted sets.
ZUnion
ZUNION numkeys key [key …] [WITHSCORES].
Returns the union of all given sorted sets.
ZDiffStore
ZDIFFSTORE destkey numkeys key [key …].
Stores the diff of sorted sets in destkey. Returns the cardinality.
ZInterStore
ZINTERSTORE destkey numkeys key [key …].
Stores the intersection of sorted sets in destkey. Returns the cardinality.
ZUnionStore
ZUNIONSTORE destkey numkeys key [key …].
Stores the union of sorted sets in destkey. Returns the cardinality.
Type
TYPE key. Returns the type of the value stored at key.
ZAdd
ZADD key [NX|XX] [GT|LT] [CH] score member [score member …].
ZRem
ZREM key member [member …]. Removes members from a sorted set.
ZScore
ZSCORE key member. Returns the score of a member.
ZRank
ZRANK key member. Returns the rank of a member (0-based).
ZCard
ZCARD key. Returns the cardinality (number of members) of a sorted set.
ZRange
ZRANGE key start stop [WITHSCORES]. Returns a range by rank.
ZRevRange
ZREVRANGE key start stop [WITHSCORES]. Returns a range by rank in reverse order.
ZRevRank
ZREVRANK key member. Returns the reverse rank of a member.
ZCount
ZCOUNT key min max. Counts members with scores in the given range.
ZIncrBy
ZINCRBY key increment member. Increments the score of a member.
ZRangeByScore
ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count].
ZRevRangeByScore
ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count].
ZPopMin
ZPOPMIN key [count]. Removes and returns the lowest scored members.
ZPopMax
ZPOPMAX key [count]. Removes and returns the highest scored members.
Lmpop
LMPOP numkeys key [key …] LEFT|RIGHT [COUNT n].
Tries keys left-to-right, popping up to count elements from the first
non-empty list. Returns [key_name, [elem, ...]] or nil if all empty.
Zmpop
ZMPOP numkeys key [key …] MIN|MAX [COUNT n].
Tries keys left-to-right, popping up to count elements from the first
non-empty sorted set. Returns [key_name, [[member, score], ...]] or nil.
HSet
HSET key field value [field value …]. Sets field-value pairs in a hash.
HGet
HGET key field. Gets a field’s value from a hash.
HGetAll
HGETALL key. Gets all field-value pairs from a hash.
HDel
HDEL key field [field …]. Deletes fields from a hash.
HExists
HEXISTS key field. Checks if a field exists in a hash.
HLen
HLEN key. Returns the number of fields in a hash.
HIncrBy
HINCRBY key field increment. Increments a hash field’s integer value.
HKeys
HKEYS key. Returns all field names in a hash.
HVals
HVALS key. Returns all values in a hash.
HMGet
HMGET key field [field …]. Gets multiple field values from a hash.
HRandField
HRANDFIELD key [count [WITHVALUES]].
Returns random field(s) from a hash. Positive count returns distinct fields;
negative allows duplicates. With WITHVALUES, returns interleaved field-value pairs.
SAdd
SADD key member [member …]. Adds members to a set.
SRem
SREM key member [member …]. Removes members from a set.
SMembers
SMEMBERS key. Returns all members of a set.
SIsMember
SISMEMBER key member. Checks if a member exists in a set.
SCard
SCARD key. Returns the cardinality (number of members) of a set.
SUnion
SUNION key [key …]. Returns the union of all given sets.
SInter
SINTER key [key …]. Returns the intersection of all given sets.
SDiff
SDIFF key [key …]. Returns members of the first set not in the others.
SUnionStore
SUNIONSTORE destination key [key …]. Stores the union into destination.
SInterStore
SINTERSTORE destination key [key …]. Stores the intersection into destination.
SDiffStore
SDIFFSTORE destination key [key …]. Stores the difference into destination.
SRandMember
SRANDMEMBER key [count]. Returns random members without removing them.
ZRandMember
ZRANDMEMBER key [count [WITHSCORES]].
Returns random member(s) from a sorted set. Positive count returns distinct members;
negative allows duplicates. With WITHSCORES, returns interleaved member-score pairs.
SPop
SPOP key [count]. Removes and returns random members.
SMisMember
SMISMEMBER key member [member …]. Checks multiple members at once.
SMove
SMOVE source destination member. Atomically moves a member from one set to another.
Returns 1 if moved, 0 if the member was not in the source set.
SInterCard
SINTERCARD numkeys key [key …] [LIMIT count]. Returns the cardinality of the set
intersection. If LIMIT is given and nonzero, the result is capped at that value.
Expiretime
EXPIRETIME key. Returns the absolute Unix timestamp (seconds) when the key expires.
Returns -1 if the key has no expiry, -2 if the key does not exist.
Pexpiretime
PEXPIRETIME key. Returns the absolute Unix timestamp (milliseconds) when the key expires.
Returns -1 if the key has no expiry, -2 if the key does not exist.
ClusterInfo
CLUSTER INFO. Returns cluster state and configuration information.
ClusterNodes
CLUSTER NODES. Returns the list of cluster nodes.
ClusterSlots
CLUSTER SLOTS. Returns the slot distribution across nodes.
ClusterKeySlot
CLUSTER KEYSLOT key. Returns the hash slot for a key.
ClusterMyId
CLUSTER MYID. Returns the node’s ID.
ClusterSetSlotImporting
CLUSTER SETSLOT slot IMPORTING node-id. Mark slot as importing from node.
ClusterSetSlotMigrating
CLUSTER SETSLOT slot MIGRATING node-id. Mark slot as migrating to node.
ClusterSetSlotNode
CLUSTER SETSLOT slot NODE node-id. Assign slot to node.
ClusterSetSlotStable
CLUSTER SETSLOT slot STABLE. Clear importing/migrating state.
ClusterMeet
CLUSTER MEET ip port. Add a node to the cluster.
ClusterAddSlots
CLUSTER ADDSLOTS slot [slot…]. Assign slots to the local node.
ClusterAddSlotsRange
CLUSTER ADDSLOTSRANGE start end [start end …]. Assign a contiguous range of hash slots.
ClusterDelSlots
CLUSTER DELSLOTS slot [slot…]. Remove slots from the local node.
ClusterForget
CLUSTER FORGET node-id. Remove a node from the cluster.
ClusterReplicate
CLUSTER REPLICATE node-id. Make this node a replica of another.
ClusterFailover
CLUSTER FAILOVER [FORCE|TAKEOVER]. Trigger a manual failover.
ClusterCountKeysInSlot
CLUSTER COUNTKEYSINSLOT slot. Return the number of keys in a slot.
ClusterGetKeysInSlot
CLUSTER GETKEYSINSLOT slot count. Return keys in a slot.
Migrate
MIGRATE host port key db timeout [COPY] [REPLACE] [KEYS key…].
Migrate a key to another node.
Restore
RESTORE key ttl serialized-value [REPLACE].
Insert a key from serialized data (used by MIGRATE).
Asking
ASKING. Signals that the next command is for a migrating slot.
SlowLogGet
SLOWLOG GET [count]. Returns recent slow log entries.
SlowLogLen
SLOWLOG LEN. Returns the number of entries in the slow log.
SlowLogReset
SLOWLOG RESET. Clears the slow log.
Subscribe
SUBSCRIBE channel [channel …]. Subscribe to one or more channels.
Unsubscribe
UNSUBSCRIBE [channel …]. Unsubscribe from channels (all if none given).
PSubscribe
PSUBSCRIBE pattern [pattern …]. Subscribe to channels matching patterns.
PUnsubscribe
PUNSUBSCRIBE [pattern …]. Unsubscribe from patterns (all if none given).
Publish
PUBLISH channel message. Publish a message to a channel.
PubSubChannels
PUBSUB CHANNELS [pattern]. List active channels, optionally matching a glob.
PubSubNumSub
PUBSUB NUMSUB [channel …]. Returns subscriber counts for given channels.
PubSubNumPat
PUBSUB NUMPAT. Returns the number of active pattern subscriptions.
VAdd
VADD key element f32 [f32 …] [METRIC COSINE|L2|IP] [QUANT F32|F16|I8] [M n] [EF n]. Adds a vector to a vector set.
Fields
VAddBatch
VADD_BATCH key DIM n element1 f32… element2 f32… [METRIC COSINE|L2|IP] [QUANT F32|F16|I8] [M n] [EF n]. Adds multiple vectors in a single command.
Fields
VSim
VSIM key f32 [f32 …] COUNT k [EF n] [WITHSCORES]. Searches for k nearest neighbors.
VRem
VREM key element. Removes a vector from a vector set.
VGet
VGET key element. Retrieves the stored vector for an element.
VCard
VCARD key. Returns the number of elements in a vector set.
VDim
VDIM key. Returns the dimensionality of a vector set.
VInfo
VINFO key. Returns metadata about a vector set.
ProtoRegister
PROTO.REGISTER name descriptor_bytes. Registers a protobuf schema
(pre-compiled FileDescriptorSet) under the given name.
ProtoSet
PROTO.SET key type_name data [EX s | PX ms] [NX | XX].
Stores a validated protobuf value.
Fields
ProtoGet
PROTO.GET key. Returns [type_name, data] or nil.
ProtoType
PROTO.TYPE key. Returns the message type name or nil.
ProtoSchemas
PROTO.SCHEMAS. Lists all registered schema names.
ProtoDescribe
PROTO.DESCRIBE name. Lists message types in a registered schema.
ProtoGetField
PROTO.GETFIELD key field_path. Reads a single field from a
protobuf value, returning it as a native RESP3 type.
ProtoSetField
PROTO.SETFIELD key field_path value. Updates a single scalar
field in a stored protobuf value.
ProtoDelField
PROTO.DELFIELD key field_path. Clears a field to its default value.
ClientId
CLIENT ID. Returns the unique ID of the current connection.
ClientSetName
CLIENT SETNAME name. Sets a human-readable name for the connection.
ClientGetName
CLIENT GETNAME. Returns the name set by CLIENT SETNAME, or nil.
ClientList
CLIENT LIST. Returns info about all connected clients.
Auth
AUTH [username] password. Authenticate the connection.
Fields
AclWhoAmI
ACL WHOAMI. Returns the username of the current connection.
AclList
ACL LIST. Returns all users and their ACL rules.
AclUsers
ACL USERS. Returns all usernames.
AclGetUser
ACL GETUSER username. Returns detailed info about a user.
AclDelUser
ACL DELUSER username [username …]. Deletes users.
AclSetUser
ACL SETUSER username [rule …]. Creates or modifies a user.
AclCat
ACL CAT [category]. Lists categories, or commands in a category.
Watch
WATCH key [key …]. Marks keys for optimistic locking.
If any watched key is modified before EXEC, the transaction aborts.
Unwatch
UNWATCH. Clears all watched keys for the current connection.
Time
TIME. Returns the current server time as [unix_seconds, microseconds].
LastSave
LASTSAVE. Returns the unix timestamp of the last successful save.
Role
ROLE. Returns the replication role of the server.
Wait
WAIT numreplicas timeout-ms
Blocks until numreplicas replicas have acknowledged all write
commands processed before this WAIT, or until timeout_ms
milliseconds elapse. Returns the count of replicas that
acknowledged in time.
ObjectEncoding
OBJECT ENCODING key. Returns the internal encoding of the value.
ObjectRefcount
OBJECT REFCOUNT key. Returns the reference count of the value (always 1).
Copy
COPY source destination [DB db] [REPLACE]. Copies the value at source to destination.
Quit
QUIT. Requests the server to close the connection.
Monitor
MONITOR. Streams all commands processed by the server.
RandomKey
RANDOMKEY. Returns a random key from the database, or nil if empty.
Touch
TOUCH key [key …]. Updates last access time, returns count of existing keys.
Sort
SORT key [ASC|DESC] [ALPHA] [LIMIT offset count] [STORE dest].
Sorts a list, set, or sorted set and returns the sorted elements.
Command
COMMAND [COUNT | INFO name [name …] | DOCS name [name …]]
Returns metadata about supported commands. Used by client libraries for capability discovery on connect.
Fields
HIncrByFloat
HINCRBYFLOAT key field increment. Increments the float value of a hash field.
If the field doesn’t exist it is set to 0 before the operation. Returns the new value as a bulk string.
Unknown(String)
A command we don’t recognize (yet).
Implementations§
Source§impl Command
impl Command
Sourcepub fn command_name(&self) -> &'static str
pub fn command_name(&self) -> &'static str
Returns the lowercase command name as a static string.
Used for metrics labels and slow log entries. Zero allocation —
returns a &'static str for every known variant.
The match is explicit rather than derive-generated: a proc macro would obscure the string mappings, which are the thing most worth seeing at a glance when auditing command names.
Sourcepub fn is_write(&self) -> bool
pub fn is_write(&self) -> bool
Returns true if this command mutates state.
Used by the replica write-rejection layer: any command matching this predicate is redirected to the primary via MOVED rather than executed locally on a read-only replica.
Sourcepub fn acl_categories(&self) -> u64
pub fn acl_categories(&self) -> u64
Returns the ACL category bitmask for this command.
Each bit corresponds to a category (read, write, string, list, etc.)
as defined in ember-server/src/acl.rs. Used by the permission check
to determine whether a user has access to a command.
The bit values match the constants in the acl module: READ=1<<0, WRITE=1<<1, STRING=1<<2, LIST=1<<3, SET=1<<4, SORTEDSET=1<<5, HASH=1<<6, KEYSPACE=1<<7, SERVER=1<<8, CONNECTION=1<<9, TRANSACTION=1<<10, PUBSUB=1<<11, FAST=1<<12, SLOW=1<<13, ADMIN=1<<14, DANGEROUS=1<<15, CLUSTER=1<<16
Sourcepub fn primary_key(&self) -> Option<&str>
pub fn primary_key(&self) -> Option<&str>
Returns the primary key for this command, if there is one.
Used to calculate the hash slot for MOVED redirects on replicas. For multi-key commands, returns the first key.