Skip to main content

Command

Enum Command 

Source
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.

Fields

§

Set

SET key value [EX seconds | PX milliseconds] [NX | XX].

Fields

§value: Bytes
§nx: bool

Only set the key if it does not already exist.

§xx: bool

Only set the key if it already exists.

§

Incr

INCR key. Increments the integer value of a key by 1.

Fields

§

Decr

DECR key. Decrements the integer value of a key by 1.

Fields

§

IncrBy

INCRBY key increment. Increments the integer value of a key by the given amount.

Fields

§delta: i64
§

DecrBy

DECRBY key decrement. Decrements the integer value of a key by the given amount.

Fields

§delta: i64
§

IncrByFloat

INCRBYFLOAT key increment. Increments the float value of a key by the given amount.

Fields

§delta: f64
§

Append

APPEND key value. Appends a value to a string key. Returns the new length.

Fields

§value: Bytes
§

Strlen

STRLEN key. Returns the length of the string value stored at key.

Fields

§

GetRange

GETRANGE key start end. Returns a substring of the string at key.

Fields

§start: i64
§end: i64
§

SetRange

SETRANGE key offset value. Overwrites part of the string at key.

Fields

§offset: usize
§value: Bytes
§

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.

Fields

§offset: u64
§

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.

Fields

§offset: u64
§value: u8
§

BitCount

BITCOUNT key [start end [BYTE|BIT]]. Counts set bits in the string, optionally restricted to a byte or bit range.

Fields

§

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.

Fields

§bit: u8
§

BitOp

BITOP operation destkey key [key …]. Performs a bitwise operation across source strings and stores the result in destkey.

Fields

§dest: String
§keys: Vec<String>
§

Keys

KEYS pattern. Returns all keys matching a glob pattern.

Fields

§pattern: String
§

Rename

RENAME key newkey. Renames a key.

Fields

§newkey: String
§

Del

DEL key [key …]. Returns the number of keys removed.

Fields

§keys: Vec<String>

UNLINK key [key …]. Like DEL but frees memory in the background.

Fields

§keys: Vec<String>
§

Exists

EXISTS key [key …]. Returns the number of keys that exist.

Fields

§keys: Vec<String>
§

MGet

MGET key [key …]. Returns the values for all specified keys.

Fields

§keys: Vec<String>
§

MSet

MSET key value [key value …]. Sets multiple key-value pairs.

Fields

§pairs: Vec<(String, Bytes)>
§

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).

Fields

§pairs: Vec<(String, Bytes)>
§

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.

Fields

§value: Bytes
§

Expire

EXPIRE key seconds. Sets a TTL on an existing key.

Fields

§seconds: u64
§

Expireat

EXPIREAT key timestamp. Sets expiry at an absolute Unix timestamp (seconds).

Fields

§timestamp: u64
§

Ttl

TTL key. Returns remaining time-to-live in seconds.

Fields

§

Persist

PERSIST key. Removes the expiration from a key.

Fields

§

Pttl

PTTL key. Returns remaining time-to-live in milliseconds.

Fields

§

Pexpire

PEXPIRE key milliseconds. Sets a TTL in milliseconds on an existing key.

Fields

§milliseconds: u64
§

Pexpireat

PEXPIREAT key timestamp-ms. Sets expiry at an absolute Unix timestamp (milliseconds).

Fields

§timestamp_ms: u64
§

DbSize

DBSIZE. Returns the number of keys in the database.

§

Info

INFO [section]. Returns server info. Currently only supports “keyspace”.

Fields

§section: Option<String>
§

BgSave

BGSAVE. Triggers a background snapshot.

§

BgRewriteAof

BGREWRITEAOF. Triggers an AOF rewrite (snapshot + truncate).

§

FlushDb

FLUSHDB [ASYNC]. Removes all keys from the database.

Fields

§async_mode: bool
§

FlushAll

FLUSHALL [ASYNC]. Removes all keys (alias for FLUSHDB — Ember is single-database).

Fields

§async_mode: bool
§

MemoryUsage

MEMORY USAGE key [SAMPLES count]. Returns estimated memory usage in bytes.

Fields

§

ConfigGet

CONFIG GET pattern. Returns matching server configuration parameters.

Fields

§pattern: String
§

ConfigSet

CONFIG SET param value. Sets a server configuration parameter at runtime.

Fields

§param: String
§value: String
§

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.

Fields

§cursor: u64
§pattern: Option<String>
§count: Option<usize>
§

SScan

SSCAN key cursor [MATCH pattern] [COUNT count]. Iterates set members.

Fields

§cursor: u64
§pattern: Option<String>
§count: Option<usize>
§

HScan

HSCAN key cursor [MATCH pattern] [COUNT count]. Iterates hash fields.

Fields

§cursor: u64
§pattern: Option<String>
§count: Option<usize>
§

ZScan

ZSCAN key cursor [MATCH pattern] [COUNT count]. Iterates sorted set members.

Fields

§cursor: u64
§pattern: Option<String>
§count: Option<usize>
§

LPush

LPUSH key value [value …]. Pushes values to the head of a list.

Fields

§values: Vec<Bytes>
§

RPush

RPUSH key value [value …]. Pushes values to the tail of a list.

Fields

§values: Vec<Bytes>
§

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).

Fields

§count: Option<usize>
§

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).

Fields

§count: Option<usize>
§

LRange

LRANGE key start stop. Returns a range of elements by index.

Fields

§start: i64
§stop: i64
§

LLen

LLEN key. Returns the length of a list.

Fields

§

BLPop

BLPOP key [key …] timeout. Blocks until an element is available at the head of one of the given lists, or the timeout expires.

Fields

§keys: Vec<String>
§timeout_secs: f64
§

BRPop

BRPOP key [key …] timeout. Blocks until an element is available at the tail of one of the given lists, or the timeout expires.

Fields

§keys: Vec<String>
§timeout_secs: f64
§

LIndex

LINDEX key index. Returns the element at index in the list.

Fields

§index: i64
§

LSet

LSET key index element. Sets the element at index.

Fields

§index: i64
§value: Bytes
§

LTrim

LTRIM key start stop. Trims the list to the specified range.

Fields

§start: i64
§stop: i64
§

LInsert

LINSERT key BEFORE|AFTER pivot element. Inserts before or after pivot.

Fields

§before: bool
§pivot: Bytes
§value: Bytes
§

LRem

LREM key count element. Removes elements equal to value.

Fields

§count: i64
§value: Bytes
§

LPos

LPOS key element [RANK rank] [COUNT count] [MAXLEN maxlen].

Fields

§element: Bytes
§rank: i64
§count: Option<usize>
§maxlen: usize
§

LMove

LMOVE source destination LEFT|RIGHT LEFT|RIGHT. Atomically pops from the source list and pushes to the destination list.

Fields

§source: String
§destination: String
§src_left: bool

Pop from the left (head) if true, right (tail) if false.

§dst_left: bool

Push to the left (head) if true, right (tail) if false.

§

GetDel

GETDEL key. Returns the value of a key and deletes it atomically.

Fields

§

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

§expire: Option<Option<SetExpire>>

None — no change; Some(None) — remove TTL (PERSIST); Some(Some(_)) — set TTL.

§

ZDiff

ZDIFF numkeys key [key …] [WITHSCORES]. Returns members in the first sorted set not present in the others.

Fields

§keys: Vec<String>
§with_scores: bool
§

ZInter

ZINTER numkeys key [key …] [WITHSCORES]. Returns members present in all of the given sorted sets.

Fields

§keys: Vec<String>
§with_scores: bool
§

ZUnion

ZUNION numkeys key [key …] [WITHSCORES]. Returns the union of all given sorted sets.

Fields

§keys: Vec<String>
§with_scores: bool
§

ZDiffStore

ZDIFFSTORE destkey numkeys key [key …]. Stores the diff of sorted sets in destkey. Returns the cardinality.

Fields

§dest: String
§keys: Vec<String>
§

ZInterStore

ZINTERSTORE destkey numkeys key [key …]. Stores the intersection of sorted sets in destkey. Returns the cardinality.

Fields

§dest: String
§keys: Vec<String>
§

ZUnionStore

ZUNIONSTORE destkey numkeys key [key …]. Stores the union of sorted sets in destkey. Returns the cardinality.

Fields

§dest: String
§keys: Vec<String>
§

Type

TYPE key. Returns the type of the value stored at key.

Fields

§

ZAdd

ZADD key [NX|XX] [GT|LT] [CH] score member [score member …].

Fields

§members: Vec<(f64, String)>
§

ZRem

ZREM key member [member …]. Removes members from a sorted set.

Fields

§members: Vec<String>
§

ZScore

ZSCORE key member. Returns the score of a member.

Fields

§member: String
§

ZRank

ZRANK key member. Returns the rank of a member (0-based).

Fields

§member: String
§

ZCard

ZCARD key. Returns the cardinality (number of members) of a sorted set.

Fields

§

ZRange

ZRANGE key start stop [WITHSCORES]. Returns a range by rank.

Fields

§start: i64
§stop: i64
§with_scores: bool
§

ZRevRange

ZREVRANGE key start stop [WITHSCORES]. Returns a range by rank in reverse order.

Fields

§start: i64
§stop: i64
§with_scores: bool
§

ZRevRank

ZREVRANK key member. Returns the reverse rank of a member.

Fields

§member: String
§

ZCount

ZCOUNT key min max. Counts members with scores in the given range.

§

ZIncrBy

ZINCRBY key increment member. Increments the score of a member.

Fields

§increment: f64
§member: String
§

ZRangeByScore

ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count].

Fields

§with_scores: bool
§offset: usize
§count: Option<usize>
§

ZRevRangeByScore

ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count].

Fields

§with_scores: bool
§offset: usize
§count: Option<usize>
§

ZPopMin

ZPOPMIN key [count]. Removes and returns the lowest scored members.

Fields

§count: usize
§

ZPopMax

ZPOPMAX key [count]. Removes and returns the highest scored members.

Fields

§count: usize
§

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.

Fields

§keys: Vec<String>
§left: bool
§count: usize
§

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.

Fields

§keys: Vec<String>
§min: bool
§count: usize
§

HSet

HSET key field value [field value …]. Sets field-value pairs in a hash.

Fields

§fields: Vec<(String, Bytes)>
§

HGet

HGET key field. Gets a field’s value from a hash.

Fields

§field: String
§

HGetAll

HGETALL key. Gets all field-value pairs from a hash.

Fields

§

HDel

HDEL key field [field …]. Deletes fields from a hash.

Fields

§fields: Vec<String>
§

HExists

HEXISTS key field. Checks if a field exists in a hash.

Fields

§field: String
§

HLen

HLEN key. Returns the number of fields in a hash.

Fields

§

HIncrBy

HINCRBY key field increment. Increments a hash field’s integer value.

Fields

§field: String
§delta: i64
§

HKeys

HKEYS key. Returns all field names in a hash.

Fields

§

HVals

HVALS key. Returns all values in a hash.

Fields

§

HMGet

HMGET key field [field …]. Gets multiple field values from a hash.

Fields

§fields: Vec<String>
§

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.

Fields

§count: Option<i64>
§with_values: bool
§

SAdd

SADD key member [member …]. Adds members to a set.

Fields

§members: Vec<String>
§

SRem

SREM key member [member …]. Removes members from a set.

Fields

§members: Vec<String>
§

SMembers

SMEMBERS key. Returns all members of a set.

Fields

§

SIsMember

SISMEMBER key member. Checks if a member exists in a set.

Fields

§member: String
§

SCard

SCARD key. Returns the cardinality (number of members) of a set.

Fields

§

SUnion

SUNION key [key …]. Returns the union of all given sets.

Fields

§keys: Vec<String>
§

SInter

SINTER key [key …]. Returns the intersection of all given sets.

Fields

§keys: Vec<String>
§

SDiff

SDIFF key [key …]. Returns members of the first set not in the others.

Fields

§keys: Vec<String>
§

SUnionStore

SUNIONSTORE destination key [key …]. Stores the union into destination.

Fields

§dest: String
§keys: Vec<String>
§

SInterStore

SINTERSTORE destination key [key …]. Stores the intersection into destination.

Fields

§dest: String
§keys: Vec<String>
§

SDiffStore

SDIFFSTORE destination key [key …]. Stores the difference into destination.

Fields

§dest: String
§keys: Vec<String>
§

SRandMember

SRANDMEMBER key [count]. Returns random members without removing them.

Fields

§count: Option<i64>
§

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.

Fields

§count: Option<i64>
§with_scores: bool
§

SPop

SPOP key [count]. Removes and returns random members.

Fields

§count: usize
§

SMisMember

SMISMEMBER key member [member …]. Checks multiple members at once.

Fields

§members: Vec<String>
§

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.

Fields

§source: String
§destination: String
§member: String
§

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.

Fields

§keys: Vec<String>
§limit: usize
§

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.

Fields

§

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.

Fields

§

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.

Fields

§

ClusterMyId

CLUSTER MYID. Returns the node’s ID.

§

ClusterSetSlotImporting

CLUSTER SETSLOT slot IMPORTING node-id. Mark slot as importing from node.

Fields

§slot: u16
§node_id: String
§

ClusterSetSlotMigrating

CLUSTER SETSLOT slot MIGRATING node-id. Mark slot as migrating to node.

Fields

§slot: u16
§node_id: String
§

ClusterSetSlotNode

CLUSTER SETSLOT slot NODE node-id. Assign slot to node.

Fields

§slot: u16
§node_id: String
§

ClusterSetSlotStable

CLUSTER SETSLOT slot STABLE. Clear importing/migrating state.

Fields

§slot: u16
§

ClusterMeet

CLUSTER MEET ip port. Add a node to the cluster.

Fields

§port: u16
§

ClusterAddSlots

CLUSTER ADDSLOTS slot [slot…]. Assign slots to the local node.

Fields

§slots: Vec<u16>
§

ClusterAddSlotsRange

CLUSTER ADDSLOTSRANGE start end [start end …]. Assign a contiguous range of hash slots.

Fields

§ranges: Vec<(u16, u16)>
§

ClusterDelSlots

CLUSTER DELSLOTS slot [slot…]. Remove slots from the local node.

Fields

§slots: Vec<u16>
§

ClusterForget

CLUSTER FORGET node-id. Remove a node from the cluster.

Fields

§node_id: String
§

ClusterReplicate

CLUSTER REPLICATE node-id. Make this node a replica of another.

Fields

§node_id: String
§

ClusterFailover

CLUSTER FAILOVER [FORCE|TAKEOVER]. Trigger a manual failover.

Fields

§force: bool
§takeover: bool
§

ClusterCountKeysInSlot

CLUSTER COUNTKEYSINSLOT slot. Return the number of keys in a slot.

Fields

§slot: u16
§

ClusterGetKeysInSlot

CLUSTER GETKEYSINSLOT slot count. Return keys in a slot.

Fields

§slot: u16
§count: u32
§

Migrate

MIGRATE host port key db timeout [COPY] [REPLACE] [KEYS key…]. Migrate a key to another node.

Fields

§host: String
§port: u16
§db: u32
§timeout_ms: u64
§copy: bool
§replace: bool
§

Restore

RESTORE key ttl serialized-value [REPLACE]. Insert a key from serialized data (used by MIGRATE).

Fields

§ttl_ms: u64
§data: Bytes
§replace: bool
§

Asking

ASKING. Signals that the next command is for a migrating slot.

§

SlowLogGet

SLOWLOG GET [count]. Returns recent slow log entries.

Fields

§count: Option<usize>
§

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.

Fields

§channels: Vec<String>
§

Unsubscribe

UNSUBSCRIBE [channel …]. Unsubscribe from channels (all if none given).

Fields

§channels: Vec<String>
§

PSubscribe

PSUBSCRIBE pattern [pattern …]. Subscribe to channels matching patterns.

Fields

§patterns: Vec<String>
§

PUnsubscribe

PUNSUBSCRIBE [pattern …]. Unsubscribe from patterns (all if none given).

Fields

§patterns: Vec<String>
§

Publish

PUBLISH channel message. Publish a message to a channel.

Fields

§channel: String
§message: Bytes
§

PubSubChannels

PUBSUB CHANNELS [pattern]. List active channels, optionally matching a glob.

Fields

§pattern: Option<String>
§

PubSubNumSub

PUBSUB NUMSUB [channel …]. Returns subscriber counts for given channels.

Fields

§channels: Vec<String>
§

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

§element: String
§vector: Vec<f32>
§metric: u8

0 = cosine (default), 1 = l2, 2 = inner product

§quantization: u8

0 = f32 (default), 1 = f16, 2 = i8

§connectivity: u32

HNSW connectivity parameter (default 16)

§expansion_add: u32

HNSW construction beam width (default 64)

§

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

§entries: Vec<(String, Vec<f32>)>
§dim: usize
§metric: u8

0 = cosine (default), 1 = l2, 2 = inner product

§quantization: u8

0 = f32 (default), 1 = f16, 2 = i8

§connectivity: u32

HNSW connectivity parameter (default 16)

§expansion_add: u32

HNSW construction beam width (default 64)

§

VSim

VSIM key f32 [f32 …] COUNT k [EF n] [WITHSCORES]. Searches for k nearest neighbors.

Fields

§query: Vec<f32>
§count: usize
§ef_search: usize
§with_scores: bool
§

VRem

VREM key element. Removes a vector from a vector set.

Fields

§element: String
§

VGet

VGET key element. Retrieves the stored vector for an element.

Fields

§element: String
§

VCard

VCARD key. Returns the number of elements in a vector set.

Fields

§

VDim

VDIM key. Returns the dimensionality of a vector set.

Fields

§

VInfo

VINFO key. Returns metadata about a vector set.

Fields

§

ProtoRegister

PROTO.REGISTER name descriptor_bytes. Registers a protobuf schema (pre-compiled FileDescriptorSet) under the given name.

Fields

§name: String
§descriptor: Bytes
§

ProtoSet

PROTO.SET key type_name data [EX s | PX ms] [NX | XX]. Stores a validated protobuf value.

Fields

§type_name: String
§data: Bytes
§nx: bool

Only set the key if it does not already exist.

§xx: bool

Only set the key if it already exists.

§

ProtoGet

PROTO.GET key. Returns [type_name, data] or nil.

Fields

§

ProtoType

PROTO.TYPE key. Returns the message type name or nil.

Fields

§

ProtoSchemas

PROTO.SCHEMAS. Lists all registered schema names.

§

ProtoDescribe

PROTO.DESCRIBE name. Lists message types in a registered schema.

Fields

§name: String
§

ProtoGetField

PROTO.GETFIELD key field_path. Reads a single field from a protobuf value, returning it as a native RESP3 type.

Fields

§field_path: String
§

ProtoSetField

PROTO.SETFIELD key field_path value. Updates a single scalar field in a stored protobuf value.

Fields

§field_path: String
§value: String
§

ProtoDelField

PROTO.DELFIELD key field_path. Clears a field to its default value.

Fields

§field_path: String
§

ClientId

CLIENT ID. Returns the unique ID of the current connection.

§

ClientSetName

CLIENT SETNAME name. Sets a human-readable name for the connection.

Fields

§name: String
§

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

§username: Option<String>

Username for ACL-style auth. None for legacy AUTH.

§password: String

The password to validate.

§

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.

Fields

§username: String
§

AclDelUser

ACL DELUSER username [username …]. Deletes users.

Fields

§usernames: Vec<String>
§

AclSetUser

ACL SETUSER username [rule …]. Creates or modifies a user.

Fields

§username: String
§rules: Vec<String>
§

AclCat

ACL CAT [category]. Lists categories, or commands in a category.

Fields

§category: Option<String>
§

Watch

WATCH key [key …]. Marks keys for optimistic locking. If any watched key is modified before EXEC, the transaction aborts.

Fields

§keys: Vec<String>
§

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.

Fields

§numreplicas: u64
§timeout_ms: u64
§

ObjectEncoding

OBJECT ENCODING key. Returns the internal encoding of the value.

Fields

§

ObjectRefcount

OBJECT REFCOUNT key. Returns the reference count of the value (always 1).

Fields

§

Copy

COPY source destination [DB db] [REPLACE]. Copies the value at source to destination.

Fields

§source: String
§destination: String
§replace: bool
§

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.

Fields

§keys: Vec<String>
§

Sort

SORT key [ASC|DESC] [ALPHA] [LIMIT offset count] [STORE dest]. Sorts a list, set, or sorted set and returns the sorted elements.

Fields

§desc: bool
§alpha: bool
§limit: Option<(i64, i64)>
§

Command

COMMAND [COUNT | INFO name [name …] | DOCS name [name …]]

Returns metadata about supported commands. Used by client libraries for capability discovery on connect.

Fields

§subcommand: Option<String>

Optional subcommand: COUNT, INFO, DOCS, LIST. None = list all commands.

§args: Vec<String>

Arguments to the subcommand (command names for INFO/DOCS).

§

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.

Fields

§field: String
§delta: f64
§

Unknown(String)

A command we don’t recognize (yet).

Implementations§

Source§

impl Command

Source

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.

Source

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.

Source

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

Source

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.

Source§

impl Command

Source

pub fn from_frame(frame: Frame) -> Result<Command, ProtocolError>

Parses a Frame into a Command.

Expects an array frame where the first element is the command name (as a bulk or simple string) and the rest are arguments.

Trait Implementations§

Source§

impl Clone for Command

Source§

fn clone(&self) -> Command

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Command

Source§

fn eq(&self, other: &Command) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Command

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.