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:

§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
BfInfoResult
Result for the bf_info command.
BfInsertOptions
Options for the bf_insert command.
BfReserveOptions
Options for the bf_reserve command.
BfScanDumpResult
Result for the bf_scandump command.
BgsaveOptions
Options for the bgsave 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:
CfInfoResult
Result for the cf_info command.
CfInsertOptions
Options for the cf_insert command.
CfReserveOptions
Options for the cf_reserve command.
CfScanDumpResult
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.
CmsInfoResult
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.
FtAggregateOptions
Options for the ft_create command
FtAggregateResult
Result for the ft_aggregate command
FtCreateOptions
Options for the ft_create command
FtCursorStats
Cursor stats for the ft_info command
FtFieldSchema
field schema for the ft_create command
FtFlatVectorFieldAttributes
FtGcStats
Garbage collector stats for the ft_info command
FtHnswVectorFieldAttributes
FtIndexAttribute
Index attribute info
FtIndexDefinition
Index definitin for the ft_info command
FtInfoResult
Result for the ft_info command
FtLoadAttribute
Attribute for the LOAD aggregate option
FtMisspelledTerm
Misspelled term + suggestions for the ft_spellcheck command.
FtReducer
Reducer for the groupby aggregate option
FtSearchHighlightOptions
sub-options for the search option summarize
FtSearchOptions
Options for the ft_search command.
FtSearchResult
Result for the ft_search and ft_aggregate commands
FtSearchResultRow
A row in a FtSearchResult
FtSearchReturnAttribute
attribute for the search option return
FtSearchSummarizeOptions
sub-options for the search option summarize
FtSortBy
option for the sortby aggregate option
FtSpellCheckOptions
Options for the ft_spellcheck command.
FtSpellCheckResult
Result for the ft_spellcheck command.
FtSugAddOptions
Options for the ft_sugadd command.
FtSugGetOptions
Options for the ft_sugget command.
FtSuggestion
Sugestion for the ft_sugget command.
FtWithCursorOptions
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
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
JsonArrIndexOptions
Options for the json_arrindex command
JsonGetOptions
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.
TDigestInfoResult
Result for the tdigest_info command.
TDigestMergeOptions
Options for the tdigest_merge command.
TopKInfoResult
Result for the topk_info command.
TopKListWithCountResult
TsAddOptions
Options for the ts_add command.
TsCompactionRule
information about the compaction rules of a time series collection, in the context of the ts_info command.
TsCreateOptions
Options for the ts_add command.
TsCreateRuleOptions
Options for the ts_createrule command.
TsGetOptions
Options for the ts_get command.
TsGroupByOptions
Options for the ts_mrange command.
TsIncrByDecrByOptions
Options for the ts_incrby and ts_decrby commands.
TsInfoChunkResult
Additional debug result for the ts_info command.
TsInfoResult
Result for the ts_info command.
TsMGetOptions
Options for the ts_mget command.
TsMRangeOptions
Options for the ts_mrange and ts_mrevrange commands.
TsRangeOptions
Options for the ts_range and ts_revrange commands.
TsRangeSample
Result for the ts_mrange and ts_mrevrange commands.
TsSample
Result for the ts_mget command.
VAddOptions
Options for the vadd command.
VInfoResult
Result for the vinfo command.
VSimOptions
Options for the vsim 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
BfInfoParameter
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.
ClientInfoAttribute
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 and hexpire commands
FindKeys
The FindKeys value of a key specification tells the client how to continue the search for key names.
FlushingMode
Database flushing mode
FtFieldType
Field type used to declare an index schema for the ft_create command
FtIndexDataType
Redis Data type of an index defined in FtCreateOptions struct
FtLanguage
Redis search supported languages See. Supported Languages
FtPhoneticMatcher
Phonetic algorithm and language used for the FtFieldSchema::phonetic associated function
FtTermType
Term type for the option terms
FtVectorDistanceMetric
FtVectorFieldAlgorithm
FtVectorType
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 and the hgetex commands
HSetExCondition
Condition option for the hsetex command
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 and hsetex commands
SortOrder
Order option of the sort command
TsAggregationType
Aggregation type for the ts_createrule and ts_mrange commands.
TsDuplicatePolicy
Policy for handling samples with identical timestamps
TsEncoding
specifies the series samples encoding format.
VectorOrElement
Argument of the vsim command
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
BloomCommands
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
CountMinSketchCommands
A group of Redis commands related to Count-min Sketch
CuckooCommands
A group of Redis commands related to Cuckoo filters
GenericCommands
A group of generic Redis commands
GeoCommands
A group of Redis commands related to Geospatial indices
HashCommands
A group of Redis commands related to Hashes
HyperLogLogCommands
A group of Redis commands related to HyperLogLog
JsonCommands
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
SearchCommands
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
TDigestCommands
A group of Redis commands related to T-Digest
TimeSeriesCommands
A group of Redis commands related to Time Series
TopKCommands
A group of Redis commands related to Top-K
TransactionCommands
A group of Redis commands related to Transactions
VectorSetCommands
A group of Redis commands related to Vector Sets

Functions§

deserialize_bzop_min_max_result

Type Aliases§

ZMPopResult
Result for zmpop the command.