Expand description
Define Redis built-in commands in a set of traits
§Built-in commands
Because Redis offers hundreds of commands, in rustis commands have been split in several traits that gather commands by groups, most of the time, groups describe in Redis official documentation.
Depending on the group of commands, traits will be implemented by Client
,
Pipeline
, Transaction
or some of these structs.
These is the list of existing command traits:
BitmapCommands
: Bitmaps & BitfieldsBlockingCommands
: Commands that block the connection until the Redis server has a new element to send. This trait is implemented only by theClient
struct.ClusterCommands
: Redis clusterConnectionCommands
: Connection management like authentication or RESP version managementGenericCommands
: Generic commands like deleting, renaming or expiring keysGeoCommands
: Geospatial indicesScriptingCommands
: Scripts & FunctionsServerCommands
: Server management like Access Control Lists or monitoringSortedSetCommands
: Sorted sets
Redis Stack commands:
BloomCommands
: Bloom filtersCuckooCommands
: Cuckoo filtersCountMinSketchCommands
: Count min-sketchTimeSeriesCommands
: Time Series
§Example
To use a command, simply add the related trait to your use
declerations
and call the related associated function directly to a client, pipeline, transaction instance.
Commands can be directly awaited or forgotten.
use rustis::{
client::{Client, ClientPreparedCommand},
commands::{ListCommands, SortedSetCommands, ZAddOptions},
Result,
};
#[cfg_attr(feature = "tokio-runtime", tokio::main)]
#[cfg_attr(feature = "async-std-runtime", async_std::main)]
async fn main() -> Result<()> {
let client = Client::connect("127.0.0.1:6379").await?;
// Send & await ListCommands::lpush command
let _size = client.lpush("mylist", ["element1", "element2"]).await?;
// Send & forget SortedSetCommands::zadd command
let _size = client.zadd(
"mySortedSet",
[(1.0, "member1"), (2.0, "member2")],
ZAddOptions::default()
).forget();
Ok(())
}
§Documentation disclaimer
The commands traits documentation is directly adapated from the official Redis documentation found here with the following COPYRIGHT.
Structs§
- AclCat
Options - Options for the
acl_cat
command - AclDry
RunOptions - Options for the
acl_dryrun
command - AclGen
Pass Options - Options for the
acl_genpass
command - AclLog
Options - Options for the
acl_log
command - BZpop
MinMax Result - Result for the
bzpopmin
andbzpopmax
commands - BfInfo
Result redis-bloom
- Result for the
bf_info
command. - BfInsert
Options redis-bloom
- Options for the
bf_insert
command. - BfReserve
Options redis-bloom
- Options for the
bf_reserve
command. - BfScan
Dump Result redis-bloom
- Result for the
bf_scandump
command. - BitField
GetSub Command - Sub-command for the
bitfield
command - BitRange
- Interval options for the
bitcount
command - Call
Builder - Builder for calling a script/function for the following commands:
- CfInfo
Result redis-bloom
- Result for the
cf_info
command. - CfInsert
Options redis-bloom
- Options for the
cf_insert
command. - CfReserve
Options redis-bloom
- Options for the
cf_reserve
command. - CfScan
Dump Result redis-bloom
- Result for the
cf_scandump
command. - Client
Info - Client info results for the
client_info
&client_list
commands. - Client
Kill Options - Options for the
client-kill
command. - Client
List Options - Options for the client_list command.
- Client
List Result - Result for the
client_list
command. - Client
Tracking Info - Result for the
client_trackinginfo
command. - Client
Tracking Options - Options for the
client_tracking
command. - Cluster
Info - Result for the
cluster_info
command - Cluster
Link Info - Result for the
cluster_links
command - Cluster
Node Result - Cluster node result for the
cluster_shards
command. - Cluster
Shard Result - Result for the
cluster_shards
command. - CmsInfo
Result redis-bloom
- Result for the
cms_info
command. - Command
Argument command argument
- Command
Doc - Command doc result for the
command_docs
command - Command
Histogram - Command Histogram for the
latency_histogram
commands. - Command
Info - Command info result for the
command
command. - Command
List Options - Options for the
command_list
command. - Database
Overhead - Sub-result for the
memory_stats
command. - Dump
Result - Result for the
dump
command. - Engine
Stats - sub-result for the
function_stats
command. - Fail
Over Options - Options for the
failover
command. - FtAggregate
Options redis-search
- Options for the
ft_create
command - FtAggregate
Result redis-search
- Result for the
ft_aggregate
command - FtCreate
Options redis-search
- Options for the
ft_create
command - FtCursor
Stats redis-search
- Cursor stats for the
ft_info
command - FtField
Schema redis-search
- field schema for the
ft_create
command - FtFlat
Vector Field Attributes redis-search
- FtGc
Stats redis-search
- Garbage collector stats for the
ft_info
command - FtHnsw
Vector Field Attributes redis-search
- FtIndex
Attribute redis-search
- Index attribute info
- FtIndex
Definition redis-search
- Index definitin for the
ft_info
command - FtInfo
Result redis-search
- Result for the
ft_info
command - FtLoad
Attribute redis-search
- Attribute for the
LOAD
aggregate option - FtMisspelled
Term redis-search
- Misspelled term + suggestions for the
ft_spellcheck
command. - FtProfile
Aggregate Result redis-search
- Result for the
ft_profile_aggregate
command. - FtProfile
Details redis-search
- Result details of a
ft_profile_search
orft_profile_aggregate
command. - FtProfile
Search Result redis-search
- Result for the
ft_profile_search
command. - FtReducer
redis-search
- Reducer for the
groupby
aggregate option - FtResult
Processors Profile redis-search
- Result processors profile for the
ft_profile_search
orft_profile_aggregate
command. - FtSearch
Highlight Options redis-search
- sub-options for the
search
optionsummarize
- FtSearch
Options redis-search
- Options for the
ft_search
command. - FtSearch
Result redis-search
- Result for the
ft_search
command - FtSearch
Result Row redis-search
- A row in a
FtSearchResult
- FtSearch
Return Attribute redis-search
- attribute for the
search
optionreturn
- FtSearch
Summarize Options redis-search
- sub-options for the
search
optionsummarize
- FtSort
By redis-search
- option for the
sortby
aggregate option - FtSpell
Check Options redis-search
- Options for the
ft_spellcheck
command. - FtSpell
Check Result redis-search
- Result for the
ft_spellcheck
command. - FtSug
AddOptions redis-search
- Options for the
ft_sugadd
command. - FtSug
GetOptions redis-search
- Options for the
ft_sugget
command. - FtSuggestion
redis-search
- Sugestion for the
ft_sugget
command. - FtWith
Cursor Options redis-search
- options for the
withcursor
aggregate option - Function
Dump Result - Result for the
function_dump
command. - Function
Info - Sub-result for the
function_list
command. - Function
List Options - Options for the
function_list
command - Function
Stats - Result for the
function_stats
command. - GeoSearch
Options - Options for the
geosearch
command - GeoSearch
Result - Result of the
geosearch
command. - GeoSearch
Store Options - Options for the
geosearchstore
command - Graph
Edge redis-graph
- Edges (or Relationships) are persistent graph elements that connect one node to another.
- Graph
Header redis-graph
- Header part of a graph ’result set`
- Graph
Node redis-graph
- Nodes are persistent graph elements that can be connected to each other via relationships.
- Graph
Path redis-graph
- Paths are alternating sequences of nodes and edges, starting and ending with a node.
- Graph
Properties redis-graph
- Properties for a
Node
or anEdge
- Graph
Query Options redis-graph
- Options for the
graph_query
command - Graph
Query Statistics redis-graph
- Statistics part of a graph ’result set`
- Graph
Result Row redis-graph
- Result row for the
graph_query
command - Graph
Result RowSeed redis-graph
- Graph
Result Set redis-graph
- Result set for the
graph_query
command - Graph
Slowlog Result redis-graph
- Result for the
graph_slowlog
command - HScan
Options - Options for the
hscan
command - HScan
Result - Result for the
hscan
command. - Hello
Options - Options for the
hello
command. - Hello
Result - Result for the
hello
command - Historical
Note - Sub-result for the
command_docs
command - Json
ArrIndex Options redis-json
- Options for the
json_arrindex
command - Json
GetOptions redis-json
- Options for the
json_get
command - KeySpecification
- Key specifications of a command for the
command
command. - LcsMatch
- Part of the result for the
lcs
command - LcsResult
- Result for the
lcs
command - Legacy
Cluster Node Result - Cluster node result for the
cluster_slots
command. - Legacy
Cluster Shard Result - Result for the
cluster_slots
command. - Library
Info - Result for the
function_list
command. - LolWut
Options - Options for the
lolwut
command - Memory
Stats - Result for the
memory_stats
command. - Memory
Usage Options - Options for the
memory_usage
command - Migrate
Options - Options for the
migrate
command. - Module
Info - Module information result for the
module_list
command. - Module
Load Options - Options for the
module_load
command - Ping
Options - Options for the
ping
command. - PubSub
Channels Options - Options for the
pub_sub_channels
command - Replica
Info - Represents a connected replicas to a master
- Replica
OfOptions - options for the
replicaof
command. - Restore
Options - Options for the
restore
command - Running
Script - Sub-result for the
function_stats
command. - SScan
Options - Options for the
sscan
command - Scan
Options - Options for the
scan
command - Sentinel
Info - Result for the
sentinel_sentinels
command. - Sentinel
Master Info - Result for the
sentinel_master
command. - Sentinel
Replica Info - /// Result for the
sentinel_replicas
command. - Shutdown
Options - options for the
shutdown
command. - Slow
LogEntry - Result
slowlog_get
for the command. - Slow
LogOptions - options for the
slowlog_get
command. - Sort
Options - Options for the
sort
command - Stream
Entry - Result for the
xrange
and other associated commands. - TDigest
Info Result redis-bloom
- Result for the
tdigest_info
command. - TDigest
Merge Options redis-bloom
- Options for the
tdigest_merge
command. - TopK
Info Result redis-bloom
- Result for the
topk_info
command. - TopK
List With Count Result redis-bloom
- TsAdd
Options redis-time-series
- Options for the
ts_add
command. - TsCompaction
Rule redis-time-series
- information about the
compaction rules
of a time series collection, in the context of thets_info
command. - TsCreate
Options redis-time-series
- Options for the
ts_add
command. - TsCreate
Rule Options redis-time-series
- Options for the
ts_createrule
command. - TsGet
Options redis-time-series
- Options for the
ts_get
command. - TsGroup
ByOptions redis-time-series
- Options for the
ts_mrange
command. - TsIncr
ByDecr ByOptions redis-time-series
- Options for the
ts_incrby
andts_decrby
commands. - TsInfo
Chunk Result redis-time-series
- Additional debug result for the
ts_info
command. - TsInfo
Result redis-time-series
- Result for the
ts_info
command. - TsMGet
Options redis-time-series
- Options for the
ts_mget
command. - TsMRange
Options redis-time-series
- Options for the
ts_mrange
andts_mrevrange
commands. - TsRange
Options redis-time-series
- Options for the
ts_range
andts_revrange
commands. - TsRange
Sample redis-time-series
- Result for the
ts_mrange
andts_mrevrange
commands. - TsSample
redis-time-series
- Result for the
ts_mget
command. - XAdd
Options - Stream Add options for the
xadd
command. - XAuto
Claim Options - Options for the
xautoclaim
command - XAuto
Claim Result - Result for the
xautoclaim
command. - XClaim
Options - Options for the
xclaim
command - XConsumer
Info - Result entry for the
xinfo_consumers
command. - XGroup
Create Options - Options for the
xgroup_create
command - XGroup
Info - Result entry for the
xinfo_groups
command. - XInfo
Stream Options - Options for the
xinfo_stream
command - XPending
Consumer - Customer info result for the
xpending
command - XPending
Message Result - Message result for the
xpending_with_options
command - XPending
Options - Options for the
xpending_with_options
command - XPending
Result - Result for the
xpending
command - XRead
Group Options - Options for the
xreadgroup
command - XRead
Options - Options for the
xread
command - XStream
Info - Stream info returned by the
xinfo_stream
command. - XTrim
Options - Stream Trim options for the
xadd
andxtrim
commands - ZAdd
Options - Options for the
zadd
command. - ZRange
Options - Options for the
zrange
andzrangestore
commands - ZScan
Options - Options for the
zscan
command - ZScan
Result - Result for the
zscan
command.
Enums§
- Argument
Flag - Flag for a command argument
- Begin
Search - The BeginSearch value of a specification informs the client of the extraction’s beginning
- BfInfo
Parameter redis-bloom
- Optional parameter for the
bf_info
command. - BitField
Overflow - Option for the
BitFieldSubCommand
sub-command. - BitField
SubCommand - Sub-command for the
bitfield
command - BitOperation
- Bit operation for the
bitop
command. - BitUnit
- Unit of a
range
, bit or byte - Client
Caching Mode - Client caching mode for the
client_caching
command. - Client
Pause Mode - Mode options for the
client_pause
command. - Client
Reply Mode - Mode options for the
client_reply
command. - Client
Tracking Status - Status options for the
client_tracking
command. - Client
Type - Client type options for the
client_list
command. - Client
Unblock Mode - Mode options for the
client_unblock
command. - Cluster
Bump Epoch Result - Result for the
cluster_bumpepoch
command - Cluster
Failover Option - Options for the
cluster_failover
command - Cluster
Health Status - Cluster health status for the
cluster_shards
command. - Cluster
Link Direction - This link is established by the local node to the peer, or accepted by the local node from the peer.
- Cluster
Reset Type - Type of
cluster reset
- Cluster
SetSlot SubCommand - Subcommand for the
cluster_setslot
command. - Cluster
State - Cluster state used in the
cluster_state
field ofClusterInfo
- Command
Argument Type - An argument must have one of the following types:
- Command
DocFlag - Command documenation flag
- Command
Tip - Get additional information about a command
- Expire
Option - Options for the
expire
command - Find
Keys - The FindKeys value of a key specification tells the client how to continue the search for key names.
- Flushing
Mode - Database flushing mode
- FtField
Type redis-search
- Field type used to declare an index schema
for the
ft_create
command - FtIndex
Data Type redis-search
- Redis Data type of an index defined in
FtCreateOptions
struct - FtLanguage
redis-search
- Redis search supported languages
See.
Supported Languages
- FtPhonetic
Matcher redis-search
- Phonetic algorithm and language used for the
FtFieldSchema::phonetic
associated function - FtTerm
Type redis-search
- Term type for the option
terms
- FtVector
Distance Metric redis-search
- FtVector
Field Algorithm redis-search
- FtVector
Type redis-search
- Function
Restore Policy - Policy option for the
function_restore
command. - GeoAdd
Condition - Condition for the
geoadd
command - GeoSearch
By - The query’s shape is provided by one of these mandatory options:
- GeoSearch
From - The query’s center point is provided by one of these mandatory options:
- GeoSearch
Order - Matching items are returned unsorted by default. To sort them, use one of the following two options:
- GeoUnit
- Distance Unit
- GetEx
Options - Options for the
getex
command - Graph
Value redis-graph
- Object model for the different
RedisGraph Data Types
- Info
Section - Section for the
info
command. - LInsert
Where - Where option for the
linsert
command. - LMove
Where - Where option for the
lmove
command. - Latency
History Event - Latency history event for the
latency_graph
&latency_history
commands. - Migrate
Result - Result for the
migrate
command - Replication
State - The state of the replication from the point of view of the master,
- Request
Policy - This tip can help clients determine the shards to send the command in clustering mode.
- Response
Policy - This tip can help clients determine the aggregate they need to compute from the replies of multiple shards in a cluster.
- Role
Result - Result for the
role
command. - Script
Debug Mode - Options for the
script_debug
command. - Sentinel
Simulate Failure Mode - Different crash simulation scenario modes for
the
sentinel_simulate_failure
command - SetCondition
- Condition option for the
set_with_options
command - SetExpiration
- Expiration option for the
set_with_options
command - Sort
Order - Order option of the
sort
command - TsAggregation
Type redis-time-series
- Aggregation type for the
ts_createrule
andts_mrange
commands. - TsDuplicate
Policy redis-time-series
Policy
for handling samples with identical timestamps- TsEncoding
redis-time-series
- specifies the series samples encoding format.
- XTrim
Operator - Stream Trim operator for the
xadd
andxtrim
commands - ZAdd
Comparison - Comparison option for the
zadd
command - ZAdd
Condition - Condition option for the
zadd
command - ZAggregate
- Option that specify how results of an union or intersection are aggregated
- ZRange
Sort By - sort by option of the
zrange
command - ZWhere
- Where option of the
zmpop
command
Traits§
- Bitmap
Commands - A group of Redis commands related to
Bitmaps
&Bitfields
- Blocking
Commands - A group of blocking commands
- Bloom
Commands redis-bloom
- A group of Redis commands related to
Bloom filters
- Cluster
Commands - A group of Redis commands related to
Cluster Management
- Connection
Commands - A group of Redis commands related to connection management
- Count
MinSketch Commands redis-bloom
- A group of Redis commands related to
Count-min Sketch
- Cuckoo
Commands redis-bloom
- A group of Redis commands related to
Cuckoo filters
- From
Graph Value redis-graph
- Used to do
GraphValue
to user type conversion while consuming the inputGraphValue
- Generic
Commands - A group of generic Redis commands
- GeoCommands
- A group of Redis commands related to
Geospatial
indices - Graph
Commands redis-graph
- A group of Redis commands related to
RedisGraph
- Hash
Commands - A group of Redis commands related to
Hashes
- Hyper
LogLog Commands - A group of Redis commands related to
HyperLogLog
- Json
Commands redis-json
- A group of Redis commands related to
RedisJson
- List
Commands - A group of Redis commands related to
Lists
- PubSub
Commands - A group of Redis commands related to
Pub/Sub
- Scripting
Commands - A group of Redis commands related to Scripting and Functions
- Search
Commands redis-search
- A group of Redis commands related to
RedisSearch
- Sentinel
Commands - A group of Redis commands related to Sentinel
- Server
Commands - A group of Redis commands related to Server Management
- SetCommands
- A group of Redis commands related to
Sets
- Sorted
SetCommands - A group of Redis commands related to
Sorted Sets
- Stream
Commands - A group of Redis commands related to
Streams
- String
Commands - A group of Redis commands related to
Strings
- TDigest
Commands redis-bloom
- A group of Redis commands related to
T-Digest
- Time
Series Commands redis-time-series
- A group of Redis commands related to
Time Series
- TopK
Commands redis-bloom
- A group of Redis commands related to
Top-K
- Transaction
Commands - A group of Redis commands related to Transactions
Functions§
Type Aliases§
- ZMPop
Result - Result for
zmpop
the command.