Module commands

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

Redis Stack commands:

§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§

AclCatOptions
Options for the acl_cat command
AclDryRunOptions
Options for the acl_dryrun command
AclGenPassOptions
Options for the acl_genpass command
AclLogOptions
Options for the acl_log command
BZpopMinMaxResult
Result for the bzpopmin and bzpopmax commands
BfInfoResultredis-bloom
Result for the bf_info command.
BfInsertOptionsredis-bloom
Options for the bf_insert command.
BfReserveOptionsredis-bloom
Options for the bf_reserve command.
BfScanDumpResultredis-bloom
Result for the bf_scandump command.
BitFieldGetSubCommand
Sub-command for the bitfield command
BitRange
Interval options for the bitcount command
CallBuilder
Builder for calling a script/function for the following commands:
CfInfoResultredis-bloom
Result for the cf_info command.
CfInsertOptionsredis-bloom
Options for the cf_insert command.
CfReserveOptionsredis-bloom
Options for the cf_reserve command.
CfScanDumpResultredis-bloom
Result for the cf_scandump command.
ClientInfo
Client info results for the client_info & client_list commands.
ClientKillOptions
Options for the client-kill command.
ClientListOptions
Options for the client_list command.
ClientListResult
Result for the client_list command.
ClientTrackingInfo
Result for the client_trackinginfo command.
ClientTrackingOptions
Options for the client_tracking command.
ClusterInfo
Result for the cluster_info command
ClusterLinkInfo
Result for the cluster_links command
ClusterNodeResult
Cluster node result for the cluster_shards command.
ClusterShardResult
Result for the cluster_shards command.
CmsInfoResultredis-bloom
Result for the cms_info command.
CommandArgument
command argument
CommandDoc
Command doc result for the command_docs command
CommandHistogram
Command Histogram for the latency_histogram commands.
CommandInfo
Command info result for the command command.
CommandListOptions
Options for the command_list command.
DatabaseOverhead
Sub-result for the memory_stats command.
DumpResult
Result for the dump command.
EngineStats
sub-result for the function_stats command.
FailOverOptions
Options for the failover command.
FtAggregateOptionsredis-search
Options for the ft_create command
FtAggregateResultredis-search
Result for the ft_aggregate command
FtCreateOptionsredis-search
Options for the ft_create command
FtCursorStatsredis-search
Cursor stats for the ft_info command
FtFieldSchemaredis-search
field schema for the ft_create command
FtFlatVectorFieldAttributesredis-search
FtGcStatsredis-search
Garbage collector stats for the ft_info command
FtHnswVectorFieldAttributesredis-search
FtIndexAttributeredis-search
Index attribute info
FtIndexDefinitionredis-search
Index definitin for the ft_info command
FtInfoResultredis-search
Result for the ft_info command
FtLoadAttributeredis-search
Attribute for the LOAD aggregate option
FtMisspelledTermredis-search
Misspelled term + suggestions for the ft_spellcheck command.
FtProfileAggregateResultredis-search
Result for the ft_profile_aggregate command.
FtProfileDetailsredis-search
Result details of a ft_profile_search or ft_profile_aggregate command.
FtProfileSearchResultredis-search
Result for the ft_profile_search command.
FtReducerredis-search
Reducer for the groupby aggregate option
FtResultProcessorsProfileredis-search
Result processors profile for the ft_profile_search or ft_profile_aggregate command.
FtSearchHighlightOptionsredis-search
sub-options for the search option summarize
FtSearchOptionsredis-search
Options for the ft_search command.
FtSearchResultredis-search
Result for the ft_search command
FtSearchResultRowredis-search
A row in a FtSearchResult
FtSearchReturnAttributeredis-search
attribute for the search option return
FtSearchSummarizeOptionsredis-search
sub-options for the search option summarize
FtSortByredis-search
option for the sortby aggregate option
FtSpellCheckOptionsredis-search
Options for the ft_spellcheck command.
FtSpellCheckResultredis-search
Result for the ft_spellcheck command.
FtSugAddOptionsredis-search
Options for the ft_sugadd command.
FtSugGetOptionsredis-search
Options for the ft_sugget command.
FtSuggestionredis-search
Sugestion for the ft_sugget command.
FtWithCursorOptionsredis-search
options for the withcursor aggregate option
FunctionDumpResult
Result for the function_dump command.
FunctionInfo
Sub-result for the function_list command.
FunctionListOptions
Options for the function_list command
FunctionStats
Result for the function_stats command.
GeoSearchOptions
Options for the geosearch command
GeoSearchResult
Result of the geosearch command.
GeoSearchStoreOptions
Options for the geosearchstore command
GraphEdgeredis-graph
Edges (or Relationships) are persistent graph elements that connect one node to another.
GraphHeaderredis-graph
Header part of a graph ’result set`
GraphNoderedis-graph
Nodes are persistent graph elements that can be connected to each other via relationships.
GraphPathredis-graph
Paths are alternating sequences of nodes and edges, starting and ending with a node.
GraphPropertiesredis-graph
Properties for a Node or an Edge
GraphQueryOptionsredis-graph
Options for the graph_query command
GraphQueryStatisticsredis-graph
Statistics part of a graph ’result set`
GraphResultRowredis-graph
Result row for the graph_query command
GraphResultRowSeedredis-graph
GraphResultSetredis-graph
Result set for the graph_query command
GraphSlowlogResultredis-graph
Result for the graph_slowlog command
HScanOptions
Options for the hscan command
HScanResult
Result for the hscan command.
HelloOptions
Options for the hello command.
HelloResult
Result for the hello command
HistoricalNote
Sub-result for the command_docs command
JsonArrIndexOptionsredis-json
Options for the json_arrindex command
JsonGetOptionsredis-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
LegacyClusterNodeResult
Cluster node result for the cluster_slots command.
LegacyClusterShardResult
Result for the cluster_slots command.
LibraryInfo
Result for the function_list command.
LolWutOptions
Options for the lolwut command
MemoryStats
Result for the memory_stats command.
MemoryUsageOptions
Options for the memory_usage command
MigrateOptions
Options for the migrate command.
ModuleInfo
Module information result for the module_list command.
ModuleLoadOptions
Options for the module_load command
PingOptions
Options for the ping command.
PubSubChannelsOptions
Options for the pub_sub_channels command
ReplicaInfo
Represents a connected replicas to a master
ReplicaOfOptions
options for the replicaof command.
RestoreOptions
Options for the restore command
RunningScript
Sub-result for the function_stats command.
SScanOptions
Options for the sscan command
ScanOptions
Options for the scan command
SentinelInfo
Result for the sentinel_sentinels command.
SentinelMasterInfo
Result for the sentinel_master command.
SentinelReplicaInfo
/// Result for the sentinel_replicas command.
ShutdownOptions
options for the shutdown command.
SlowLogEntry
Result slowlog_get for the command.
SlowLogOptions
options for the slowlog_get command.
SortOptions
Options for the sort command
StreamEntry
Result for the xrange and other associated commands.
TDigestInfoResultredis-bloom
Result for the tdigest_info command.
TDigestMergeOptionsredis-bloom
Options for the tdigest_merge command.
TopKInfoResultredis-bloom
Result for the topk_info command.
TopKListWithCountResultredis-bloom
TsAddOptionsredis-time-series
Options for the ts_add command.
TsCompactionRuleredis-time-series
information about the compaction rules of a time series collection, in the context of the ts_info command.
TsCreateOptionsredis-time-series
Options for the ts_add command.
TsCreateRuleOptionsredis-time-series
Options for the ts_createrule command.
TsGetOptionsredis-time-series
Options for the ts_get command.
TsGroupByOptionsredis-time-series
Options for the ts_mrange command.
TsIncrByDecrByOptionsredis-time-series
Options for the ts_incrby and ts_decrby commands.
TsInfoChunkResultredis-time-series
Additional debug result for the ts_info command.
TsInfoResultredis-time-series
Result for the ts_info command.
TsMGetOptionsredis-time-series
Options for the ts_mget command.
TsMRangeOptionsredis-time-series
Options for the ts_mrange and ts_mrevrange commands.
TsRangeOptionsredis-time-series
Options for the ts_range and ts_revrange commands.
TsRangeSampleredis-time-series
Result for the ts_mrange and ts_mrevrange commands.
TsSampleredis-time-series
Result for the ts_mget command.
XAddOptions
Stream Add options for the xadd command.
XAutoClaimOptions
Options for the xautoclaim command
XAutoClaimResult
Result for the xautoclaim command.
XClaimOptions
Options for the xclaim command
XConsumerInfo
Result entry for the xinfo_consumers command.
XGroupCreateOptions
Options for the xgroup_create command
XGroupInfo
Result entry for the xinfo_groups command.
XInfoStreamOptions
Options for the xinfo_stream command
XPendingConsumer
Customer info result for the xpending command
XPendingMessageResult
Message result for the xpending_with_options command
XPendingOptions
Options for the xpending_with_options command
XPendingResult
Result for the xpending command
XReadGroupOptions
Options for the xreadgroup command
XReadOptions
Options for the xread command
XStreamInfo
Stream info returned by the xinfo_stream command.
XTrimOptions
Stream Trim options for the xadd and xtrim commands
ZAddOptions
Options for the zadd command.
ZRangeOptions
Options for the zrange and zrangestore commands
ZScanOptions
Options for the zscan command
ZScanResult
Result for the zscan command.

Enums§

ArgumentFlag
Flag for a command argument
BeginSearch
The BeginSearch value of a specification informs the client of the extraction’s beginning
BfInfoParameterredis-bloom
Optional parameter for the bf_info command.
BitFieldOverflow
Option for the BitFieldSubCommand sub-command.
BitFieldSubCommand
Sub-command for the bitfield command
BitOperation
Bit operation for the bitop command.
BitUnit
Unit of a range, bit or byte
ClientCachingMode
Client caching mode for the client_caching command.
ClientPauseMode
Mode options for the client_pause command.
ClientReplyMode
Mode options for the client_reply command.
ClientTrackingStatus
Status options for the client_tracking command.
ClientType
Client type options for the client_list command.
ClientUnblockMode
Mode options for the client_unblock command.
ClusterBumpEpochResult
Result for the cluster_bumpepoch command
ClusterFailoverOption
Options for the cluster_failover command
ClusterHealthStatus
Cluster health status for the cluster_shards command.
ClusterLinkDirection
This link is established by the local node to the peer, or accepted by the local node from the peer.
ClusterResetType
Type of cluster reset
ClusterSetSlotSubCommand
Subcommand for the cluster_setslot command.
ClusterState
Cluster state used in the cluster_state field of ClusterInfo
CommandArgumentType
An argument must have one of the following types:
CommandDocFlag
Command documenation flag
CommandTip
Get additional information about a command
ExpireOption
Options for the expire command
FindKeys
The FindKeys value of a key specification tells the client how to continue the search for key names.
FlushingMode
Database flushing mode
FtFieldTyperedis-search
Field type used to declare an index schema for the ft_create command
FtIndexDataTyperedis-search
Redis Data type of an index defined in FtCreateOptions struct
FtLanguageredis-search
Redis search supported languages See. Supported Languages
FtPhoneticMatcherredis-search
Phonetic algorithm and language used for the FtFieldSchema::phonetic associated function
FtTermTyperedis-search
Term type for the option terms
FtVectorDistanceMetricredis-search
FtVectorFieldAlgorithmredis-search
FtVectorTyperedis-search
FunctionRestorePolicy
Policy option for the function_restore command.
GeoAddCondition
Condition for the geoadd command
GeoSearchBy
The query’s shape is provided by one of these mandatory options:
GeoSearchFrom
The query’s center point is provided by one of these mandatory options:
GeoSearchOrder
Matching items are returned unsorted by default. To sort them, use one of the following two options:
GeoUnit
Distance Unit
GetExOptions
Options for the getex command
GraphValueredis-graph
Object model for the different RedisGraph Data Types
InfoSection
Section for the info command.
LInsertWhere
Where option for the linsert command.
LMoveWhere
Where option for the lmove command.
LatencyHistoryEvent
Latency history event for the latency_graph & latency_history commands.
MigrateResult
Result for the migrate command
ReplicationState
The state of the replication from the point of view of the master,
RequestPolicy
This tip can help clients determine the shards to send the command in clustering mode.
ResponsePolicy
This tip can help clients determine the aggregate they need to compute from the replies of multiple shards in a cluster.
RoleResult
Result for the role command.
ScriptDebugMode
Options for the script_debug command.
SentinelSimulateFailureMode
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
SortOrder
Order option of the sort command
TsAggregationTyperedis-time-series
Aggregation type for the ts_createrule and ts_mrange commands.
TsDuplicatePolicyredis-time-series
Policy for handling samples with identical timestamps
TsEncodingredis-time-series
specifies the series samples encoding format.
XTrimOperator
Stream Trim operator for the xadd and xtrim commands
ZAddComparison
Comparison option for the zadd command
ZAddCondition
Condition option for the zadd command
ZAggregate
Option that specify how results of an union or intersection are aggregated
ZRangeSortBy
sort by option of the zrange command
ZWhere
Where option of the zmpop command

Traits§

BitmapCommands
A group of Redis commands related to Bitmaps & Bitfields
BlockingCommands
A group of blocking commands
BloomCommandsredis-bloom
A group of Redis commands related to Bloom filters
ClusterCommands
A group of Redis commands related to Cluster Management
ConnectionCommands
A group of Redis commands related to connection management
CountMinSketchCommandsredis-bloom
A group of Redis commands related to Count-min Sketch
CuckooCommandsredis-bloom
A group of Redis commands related to Cuckoo filters
FromGraphValueredis-graph
Used to do GraphValue to user type conversion while consuming the input GraphValue
GenericCommands
A group of generic Redis commands
GeoCommands
A group of Redis commands related to Geospatial indices
GraphCommandsredis-graph
A group of Redis commands related to RedisGraph
HashCommands
A group of Redis commands related to Hashes
HyperLogLogCommands
A group of Redis commands related to HyperLogLog
JsonCommandsredis-json
A group of Redis commands related to RedisJson
ListCommands
A group of Redis commands related to Lists
PubSubCommands
A group of Redis commands related to Pub/Sub
ScriptingCommands
A group of Redis commands related to Scripting and Functions
SearchCommandsredis-search
A group of Redis commands related to RedisSearch
SentinelCommands
A group of Redis commands related to Sentinel
ServerCommands
A group of Redis commands related to Server Management
SetCommands
A group of Redis commands related to Sets
SortedSetCommands
A group of Redis commands related to Sorted Sets
StreamCommands
A group of Redis commands related to Streams
StringCommands
A group of Redis commands related to Strings
TDigestCommandsredis-bloom
A group of Redis commands related to T-Digest
TimeSeriesCommandsredis-time-series
A group of Redis commands related to Time Series
TopKCommandsredis-bloom
A group of Redis commands related to Top-K
TransactionCommands
A group of Redis commands related to Transactions

Functions§

deserialize_bzop_min_max_result

Type Aliases§

ZMPopResult
Result for zmpop the command.