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§
- Options for the
acl_cat
command - Options for the
acl_dryrun
command - Options for the
acl_genpass
command - Options for the
acl_log
command - BfInfoResult
redis-bloom
Result for thebf_info
command. - BfInsertOptions
redis-bloom
Options for thebf_insert
command. - BfReserveOptions
redis-bloom
Options for thebf_reserve
command. - BfScanDumpResult
redis-bloom
Result for thebf_scandump
command. - Sub-command for the
bitfield
command - Interval options for the
bitcount
command - Builder for calling a script/function for the following commands:
- CfInfoResult
redis-bloom
Result for thecf_info
command. - CfInsertOptions
redis-bloom
Options for thecf_insert
command. - CfReserveOptions
redis-bloom
Options for thecf_reserve
command. - CfScanDumpResult
redis-bloom
Result for thecf_scandump
command. - Client info results for the
client_info
&client_list
commands. - Options for the
client-kill
command. - Options for the client_list command.
- Result for the
client_list
command. - Result for the
client_trackinginfo
command. - Options for the
client_tracking
command. - Result for the
cluster_info
command - Result for the
cluster_links
command - Cluster node result for the
cluster_shards
command. - Result for the
cluster_shards
command. - CmsInfoResult
redis-bloom
Result for thecms_info
command. - Command doc result for the
command_docs
command - Command Histogram for the
latency_histogram
commands. - Command info result for the
command
command. - Options for the
command_list
command. - Sub-result for the
memory_stats
command. - Result for the
dump
command. - sub-result for the
function_stats
command. - Options for the
failover
command. - FtAggregateOptions
redis-search
Options for theft_create
command - FtAggregateResult
redis-search
Result for theft_aggregate
command - FtCreateOptions
redis-search
Options for theft_create
command - FtCursorStats
redis-search
Cursor stats for theft_info
command - FtFieldSchema
redis-search
field schema for theft_create
command - FtFlatVectorFieldAttributes
redis-search
- FtGcStats
redis-search
Garbage collector stats for theft_info
command - FtHnswVectorFieldAttributes
redis-search
- FtIndexAttribute
redis-search
Index attribute info - FtIndexDefinition
redis-search
Index definitin for theft_info
command - FtInfoResult
redis-search
Result for theft_info
command - FtLoadAttribute
redis-search
Attribute for theLOAD
aggregate option - FtMisspelledTerm
redis-search
Misspelled term + suggestions for theft_spellcheck
command. - FtProfileAggregateResult
redis-search
Result for theft_profile_aggregate
command. - FtProfileDetails
redis-search
Result details of aft_profile_search
orft_profile_aggregate
command. - FtProfileSearchResult
redis-search
Result for theft_profile_search
command. - FtReducer
redis-search
Reducer for thegroupby
aggregate option - FtResultProcessorsProfile
redis-search
Result processors profile for theft_profile_search
orft_profile_aggregate
command. - FtSearchHighlightOptions
redis-search
- FtSearchOptions
redis-search
Options for theft_search
command. - FtSearchResult
redis-search
Result for theft_search
command - FtSearchResultRow
redis-search
A row in aFtSearchResult
- FtSearchReturnAttribute
redis-search
- FtSearchSummarizeOptions
redis-search
- FtSortBy
redis-search
option for thesortby
aggregate option - FtSpellCheckOptions
redis-search
Options for theft_spellcheck
command. - FtSpellCheckResult
redis-search
Result for theft_spellcheck
command. - FtSugAddOptions
redis-search
Options for theft_sugadd
command. - FtSugGetOptions
redis-search
Options for theft_sugget
command. - FtSuggestion
redis-search
Sugestion for theft_sugget
command. - FtWithCursorOptions
redis-search
options for thewithcursor
aggregate option - Result for the
function_dump
command. - Sub-result for the
function_list
command. - Options for the
function_list
command - Result for the
function_stats
command. - Options for the
geosearch
command - Result of the
geosearch
command. - Options for the
geosearchstore
command - GraphEdge
redis-graph
Edges (or Relationships) are persistent graph elements that connect one node to another. - GraphHeader
redis-graph
Header part of a graph ’result set` - GraphNode
redis-graph
Nodes are persistent graph elements that can be connected to each other via relationships. - GraphPath
redis-graph
Paths are alternating sequences of nodes and edges, starting and ending with a node. - GraphProperties
redis-graph
- GraphQueryOptions
redis-graph
Options for thegraph_query
command - GraphQueryStatistics
redis-graph
Statistics part of a graph ’result set` - GraphResultRow
redis-graph
Result row for thegraph_query
command - GraphResultRowSeed
redis-graph
- GraphResultSet
redis-graph
Result set for thegraph_query
command - GraphSlowlogResult
redis-graph
Result for thegraph_slowlog
command - Options for the
hscan
command - Result for the
hscan
command. - Options for the
hello
command. - Result for the
hello
command - Sub-result for the
command_docs
command - JsonArrIndexOptions
redis-json
Options for thejson_arrindex
command - JsonGetOptions
redis-json
Options for thejson_get
command - Key specifications of a command for the
command
command. - Part of the result for the
lcs
command - Result for the
lcs
command - Cluster node result for the
cluster_slots
command. - Result for the
cluster_slots
command. - Result for the
function_list
command. - Options for the
lolwut
command - Result for the
memory_stats
command. - Options for the
memory_usage
command - Options for the
migrate
command. - Module information result for the
module_list
command. - Options for the
module_load
command - Options for the
ping
command. - Options for the
pub_sub_channels
command - Represents a connected replicas to a master
- options for the
replicaof
command. - Options for the
restore
command - Sub-result for the
function_stats
command. - Options for the
sscan
command - Options for the
scan
command - Result for the
sentinel_sentinels
command. - Result for the
sentinel_master
command. - /// Result for the
sentinel_replicas
command. - options for the
shutdown
command. - Result
slowlog_get
for the command. - options for the
slowlog_get
command. - Options for the
sort
command - Result for the
xrange
and other associated commands. - TDigestInfoResult
redis-bloom
Result for thetdigest_info
command. - TDigestMergeOptions
redis-bloom
Options for thetdigest_merge
command. - TopKInfoResult
redis-bloom
Result for thetopk_info
command. - TopKListWithCountResult
redis-bloom
- TsAddOptions
redis-time-series
Options for thets_add
command. - TsCompactionRule
redis-time-series
information about thecompaction rules
of a time series collection, in the context of thets_info
command. - TsCreateOptions
redis-time-series
Options for thets_add
command. - TsCreateRuleOptions
redis-time-series
Options for thets_createrule
command. - TsGetOptions
redis-time-series
Options for thets_get
command. - TsGroupByOptions
redis-time-series
Options for thets_mrange
command. - TsIncrByDecrByOptions
redis-time-series
- TsInfoChunkResult
redis-time-series
Additional debug result for thets_info
command. - TsInfoResult
redis-time-series
Result for thets_info
command. - TsMGetOptions
redis-time-series
Options for thets_mget
command. - TsMRangeOptions
redis-time-series
Options for thets_mrange
andts_mrevrange
commands. - TsRangeOptions
redis-time-series
Options for thets_range
andts_revrange
commands. - TsRangeSample
redis-time-series
Result for thets_mrange
andts_mrevrange
commands. - TsSample
redis-time-series
Result for thets_mget
command. - Stream Add options for the
xadd
command. - Options for the
xautoclaim
command - Result for the
xautoclaim
command. - Options for the
xclaim
command - Result entry for the
xinfo_consumers
command. - Options for the
xgroup_create
command - Result entry for the
xinfo_groups
command. - Options for the
xinfo_stream
command - Customer info result for the
xpending
command - Message result for the
xpending_with_options
command - Options for the
xpending_with_options
command - Result for the
xpending
command - Options for the
xreadgroup
command - Options for the
xread
command - Stream info returned by the
xinfo_stream
command. - Options for the
zadd
command. - Options for the
zrange
andzrangestore
commands - Options for the
zscan
command - Result for the
zscan
command.
Enums§
- Flag for a command argument
- The BeginSearch value of a specification informs the client of the extraction’s beginning
- BfInfoParameter
redis-bloom
Optional parameter for thebf_info
command. - Option for the
BitFieldSubCommand
sub-command. - Sub-command for the
bitfield
command - Bit operation for the
bitop
command. - Unit of a
range
, bit or byte - Client caching mode for the
client_caching
command. - Mode options for the
client_pause
command. - Mode options for the
client_reply
command. - Status options for the
client_tracking
command. - Client type options for the
client_list
command. - Mode options for the
client_unblock
command. - Result for the
cluster_bumpepoch
command - Options for the
cluster_failover
command - Cluster health status for the
cluster_shards
command. - This link is established by the local node to the peer, or accepted by the local node from the peer.
- Type of
cluster reset
- Subcommand for the
cluster_setslot
command. - Cluster state used in the
cluster_state
field ofClusterInfo
- An argument must have one of the following types:
- Command documenation flag
- Get additional information about a command
- Options for the
expire
command - The FindKeys value of a key specification tells the client how to continue the search for key names.
- Database flushing mode
- FtFieldType
redis-search
Field type used to declare an index schema for theft_create
command - FtIndexDataType
redis-search
Redis Data type of an index defined inFtCreateOptions
struct - FtLanguage
redis-search
Redis search supported languages See.Supported Languages
- FtPhoneticMatcher
redis-search
Phonetic algorithm and language used for theFtFieldSchema::phonetic
associated function - FtTermType
redis-search
Term type for the optionterms
- FtVectorDistanceMetric
redis-search
- FtVectorFieldAlgorithm
redis-search
- FtVectorType
redis-search
- Policy option for the
function_restore
command. - Condition for the
geoadd
command - The query’s shape is provided by one of these mandatory options:
- The query’s center point is provided by one of these mandatory options:
- Matching items are returned unsorted by default. To sort them, use one of the following two options:
- Distance Unit
- Options for the
getex
command - GraphValue
redis-graph
Object model for the differentRedisGraph Data Types
- Section for the
info
command. - Where option for the
linsert
command. - Where option for the
lmove
command. - Latency history event for the
latency_graph
&latency_history
commands. - Result for the
migrate
command - The state of the replication from the point of view of the master,
- This tip can help clients determine the shards to send the command in clustering mode.
- This tip can help clients determine the aggregate they need to compute from the replies of multiple shards in a cluster.
- Result for the
role
command. - Options for the
script_debug
command. - Different crash simulation scenario modes for the
sentinel_simulate_failure
command - Condition option for the
set_with_options
command - Expiration option for the
set_with_options
command - Order option of the
sort
command - TsAggregationType
redis-time-series
Aggregation type for thets_createrule
andts_mrange
commands. - TsDuplicatePolicy
redis-time-series
Policy
for handling samples with identical timestamps - TsEncoding
redis-time-series
specifies the series samples encoding format. - Comparison option for the
zadd
command - Condition option for the
zadd
command - Option that specify how results of an union or intersection are aggregated
- sort by option of the
zrange
command - Where option of the
zmpop
command
Traits§
- A group of blocking commands
- BloomCommands
redis-bloom
A group of Redis commands related toBloom filters
- A group of Redis commands related to
Cluster Management
- A group of Redis commands related to connection management
- CountMinSketchCommands
redis-bloom
A group of Redis commands related toCount-min Sketch
- CuckooCommands
redis-bloom
A group of Redis commands related toCuckoo filters
- FromGraphValue
redis-graph
Used to doGraphValue
to user type conversion while consuming the inputGraphValue
- A group of generic Redis commands
- A group of Redis commands related to
Geospatial
indices - GraphCommands
redis-graph
A group of Redis commands related toRedisGraph
- A group of Redis commands related to
Hashes
- A group of Redis commands related to
HyperLogLog
- JsonCommands
redis-json
A group of Redis commands related toRedisJson
- A group of Redis commands related to
Lists
- A group of Redis commands related to
Pub/Sub
- A group of Redis commands related to Scripting and Functions
- SearchCommands
redis-search
A group of Redis commands related toRedisSearch
- A group of Redis commands related to Sentinel
- A group of Redis commands related to Server Management
- A group of Redis commands related to
Sets
- A group of Redis commands related to
Sorted Sets
- A group of Redis commands related to
Streams
- A group of Redis commands related to
Strings
- TDigestCommands
redis-bloom
A group of Redis commands related toT-Digest
- TimeSeriesCommands
redis-time-series
A group of Redis commands related toTime Series
- TopKCommands
redis-bloom
A group of Redis commands related toTop-K
- A group of Redis commands related to Transactions
Functions§
Type Aliases§
- Result for
zmpop
the command.