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 theClientstruct.ClusterCommands: Redis clusterConnectionCommands: Connection management like authentication or RESP version managementGenericCommands: Generic commands like deleting, renaming or expiring keysGeoCommands: Geospatial indicesHashCommands: HashesHyperLogLogCommands: HyperLogLogListCommands: ListsPubSubCommands: Pub/SubScriptingCommands: Scripts & FunctionsSentinelCommands: SentinelServerCommands: Server management like Access Control Lists or monitoringSetCommands: SetsSortedSetCommands: Sorted setsStreamCommands: StreamsStringCommands: StringsVectorSetCommands: Vector setsTransactionCommands: TransactionsBloomCommands: Bloom filtersCuckooCommands: Cuckoo filtersCountMinSketchCommands: Count min-sketchJsonCommands: RedisJsonSearchCommands: RedisSearchTDigestCommands: T-DigestTimeSeriesCommands: Time SeriesTopKCommands: Top-K
§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_catcommand - AclDry
RunOptions - Options for the
acl_dryruncommand - AclGen
Pass Options - Options for the
acl_genpasscommand - AclLog
Options - Options for the
acl_logcommand - BZpop
MinMax Result - Result for the
bzpopminandbzpopmaxcommands - BfInfo
Result - Result for the
bf_infocommand. - BfInsert
Options - Options for the
bf_insertcommand. - BfReserve
Options - Options for the
bf_reservecommand. - BfScan
Dump Result - Result for the
bf_scandumpcommand. - Bgsave
Options - Options for the
bgsavecommand - BitRange
- Interval options for the
bitcountcommand - CfInfo
Result - Result for the
cf_infocommand. - CfInsert
Options - Options for the
cf_insertcommand. - CfReserve
Options - Options for the
cf_reservecommand. - CfScan
Dump Result - Result for the
cf_scandumpcommand. - Client
Info - Client info results for the
client_info&client_listcommands. - Client
Kill Options - Options for the
client-killcommand. - Client
List Options - Options for the client_list command.
- Client
List Result - Result for the
client_listcommand. - Client
Tracking Info - Result for the
client_trackinginfocommand. - Client
Tracking Options - Options for the
client_trackingcommand. - Cluster
Info - Result for the
cluster_infocommand - Cluster
Link Info - Result for the
cluster_linkscommand - Cluster
Node Result - Cluster node result for the
cluster_shardscommand. - Cluster
Shard Result - Result for the
cluster_shardscommand. - CmsInfo
Result - Result for the
cms_infocommand. - Command
Argument command argument- Command
Doc - Command doc result for the
command_docscommand - Command
Histogram - Command Histogram for the
latency_histogramcommands. - Command
Info - Command info result for the
commandcommand. - Command
List Options - Options for the
command_listcommand. - Database
Overhead - Sub-result for the
memory_statscommand. - Engine
Stats - sub-result for the
function_statscommand. - Fail
Over Options - Options for the
failovercommand. - FtAggregate
Options - Options for the
ft_createcommand - FtAggregate
Result - Result for the
ft_aggregatecommand - FtAttribute
- Attribute for the
LOADaggregate option - FtCreate
Options - Options for the
ft_createcommand - FtCursor
Stats - Cursor stats for the
ft_infocommand - FtField
Schema - field schema for the
ft_createcommand - FtFlat
Vector Field Attributes - FtGc
Stats - Garbage collector stats for the
ft_infocommand - FtGroup
By - FtHnsw
Vector Field Attributes - FtIndex
Attribute - Index attribute info
- FtIndex
Definition - Index definitin for the
ft_infocommand - FtInfo
Result - Result for the
ft_infocommand - FtMisspelled
Term - Misspelled term + suggestions for the
ft_spellcheckcommand. - FtReducer
- Reducer for the
groupbyaggregate option - FtSearch
Highlight Options - sub-options for the
searchoptionsummarize - FtSearch
Options - Options for the
ft_searchcommand. - FtSearch
Result - Result for the
ft_searchandft_aggregatecommands - FtSearch
Result Row - A row in a
FtSearchResult - FtSearch
Summarize Options - sub-options for the
searchoptionsummarize - FtSort
By - option for the
sortbyaggregate option - FtSort
ByProperty - option for the
sortbyaggregate option - FtSpell
Check Options - Options for the
ft_spellcheckcommand. - FtSpell
Check Result - Result for the
ft_spellcheckcommand. - FtSug
AddOptions - Options for the
ft_sugaddcommand. - FtSug
GetOptions - Options for the
ft_suggetcommand. - FtWith
Cursor Options - options for the
withcursoraggregate option - Function
Info - Sub-result for the
function_listcommand. - Function
List Options - Options for the
function_listcommand - Function
Stats - Result for the
function_statscommand. - GeoSearch
Options - Options for the
geosearchcommand - GeoSearch
Result - Result of the
geosearchcommand. - GeoSearch
Store Options - Options for the
geosearchstorecommand - HScan
Options - Options for the
hscancommand - HScan
Result - Result for the
hscancommand. - Hello
Options - Options for the
hellocommand. - Hello
Result - Result for the
hellocommand - Historical
Note - Sub-result for the
command_docscommand - Json
ArrIndex Options - Options for the
json_arrindexcommand - Json
GetOptions - Options for the
json_getcommand - KeySpecification
- Key specifications of a command for the
commandcommand. - LcsMatch
- Part of the result for the
lcscommand - LcsResult
- Result for the
lcscommand - Legacy
Cluster Node Result - Cluster node result for the
cluster_slotscommand. - Legacy
Cluster Shard Result - Result for the
cluster_slotscommand. - Library
Info - Result for the
function_listcommand. - LolWut
Options - Options for the
lolwutcommand - Memory
Stats - Result for the
memory_statscommand. - Memory
Usage Options - Options for the
memory_usagecommand - Migrate
Options - Options for the
migratecommand. - Module
Info - Module information result for the
module_listcommand. - Replica
Info - Represents a connected replicas to a master
- Restore
Options - Options for the
restorecommand - Running
Script - Sub-result for the
function_statscommand. - SScan
Options - Options for the
sscancommand - Scan
Options - Options for the
scancommand - Sentinel
Info - Result for the
sentinel_sentinelscommand. - Sentinel
Master Info - Result for the
sentinel_mastercommand. - Sentinel
Replica Info - /// Result for the
sentinel_replicascommand. - Shutdown
Options - options for the
shutdowncommand. - Slow
LogEntry - Result
slowlog_getfor the command. - Slow
LogGet Options - options for the
slowlog_getcommand. - Sort
Options - Options for the
sortcommand - Stream
Entry - Result for the
xrangeand other associated commands. - TDigest
Info Result - Result for the
tdigest_infocommand. - TDigest
Merge Options - Options for the
tdigest_mergecommand. - TopK
Info Result - Result for the
topk_infocommand. - TopK
List With Count Result - TsAdd
Options - Options for the
ts_addcommand. - TsCompaction
Rule - information about the
compaction rulesof a time series collection, in the context of thets_infocommand. - TsCreate
Options - Options for the
ts_addcommand. - TsCreate
Rule Options - Options for the
ts_createrulecommand. - TsGet
Options - Options for the
ts_getcommand. - TsGroup
ByOptions - Options for the
ts_mrangecommand. - TsIncr
ByDecr ByOptions - Options for the
ts_incrbyandts_decrbycommands. - TsInfo
Chunk Result - Additional debug result for the
ts_infocommand. - TsInfo
Result - Result for the
ts_infocommand. - TsMGet
Options - Options for the
ts_mgetcommand. - TsMRange
Options - Options for the
ts_mrangeandts_mrevrangecommands. - TsRange
Options - Options for the
ts_rangeandts_revrangecommands. - TsRange
Sample - Result for the
ts_mrangeandts_mrevrangecommands. - TsSample
- Result for the
ts_mgetcommand. - VAdd
Options - Options for the
vaddcommand. - VInfo
Result - Result for the
vinfocommand. - VSim
Options - Options for the
vsimcommand. - XAdd
Options - Stream Add options for the
xaddcommand. - XAuto
Claim Options - Options for the
xautoclaimcommand - XAuto
Claim Result - Result for the
xautoclaimcommand. - XClaim
Options - Options for the
xclaimcommand - XConsumer
Info - Result entry for the
xinfo_consumerscommand. - XGroup
Create Options - Options for the
xgroup_createcommand - XGroup
Info - Result entry for the
xinfo_groupscommand. - XInfo
Stream Options - Options for the
xinfo_streamcommand - XPending
Consumer - Customer info result for the
xpendingcommand - XPending
Message Result - Message result for the
xpending_with_optionscommand - XPending
Options - Options for the
xpending_with_optionscommand - XPending
Result - Result for the
xpendingcommand - XRead
Group Options - Options for the
xreadgroupcommand - XRead
Options - Options for the
xreadcommand - XStream
Info - Stream info returned by the
xinfo_streamcommand. - XTrim
Options - Stream Trim options for the
xaddandxtrimcommands - ZAdd
Options - Options for the
zaddcommand. - ZRange
Options - Options for the
zrangeandzrangestorecommands - ZScan
Options - Options for the
zscancommand - ZScan
Result - Result for the
zscancommand.
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 - Optional parameter for the
bf_infocommand. - BitField
Overflow - Option for the
BitFieldSubCommandsub-command. - BitField
SubCommand - Sub-command for the
bitfieldcommand - BitOperation
- Bit operation for the
bitopcommand. - BitUnit
- Unit of a
range, bit or byte - Client
Caching Mode - Client caching mode for the
client_cachingcommand. - Client
Info Attribute - Client
Pause Mode - Mode options for the
client_pausecommand. - Client
Reply Mode - Mode options for the
client_replycommand. - Client
Tracking Status - Status options for the
client_trackingcommand. - Client
Type - Client type options for the
client_listcommand. - Client
Unblock Mode - Mode options for the
client_unblockcommand. - Cluster
Bump Epoch Result - Result for the
cluster_bumpepochcommand - Cluster
Failover Option - Options for the
cluster_failovercommand - Cluster
Health Status - Cluster health status for the
cluster_shardscommand. - 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_setslotcommand. - Cluster
State - Cluster state used in the
cluster_statefield 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
- Consumer
Group Options - Consumer group options for the
xaddcommand. - Expire
Option - Options for the
expireandhexpirecommands - 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 - Field type used to declare an index schema
for the
ft_createcommand - FtIndex
Data Type - Redis Data type of an index defined in
FtCreateOptionsstruct - FtLanguage
- Redis search supported languages
See.
Supported Languages - FtPhonetic
Matcher - Phonetic algorithm and language used for the
FtFieldSchema::phoneticassociated function - FtScorer
Options - options for the
scoreraggregate option - FtTerm
Type - Term type for the option
terms - FtVector
Distance Metric - FtVector
Field Algorithm - FtVector
Type - Function
Restore Policy - Policy option for the
function_restorecommand. - GeoAdd
Condition - Condition for the
geoaddcommand - 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
getexand thehgetexcommands - HSet
ExCondition - Condition option for the
hsetexcommand - Info
Section - Section for the
infocommand. - KeyType
- Result for the
typecommand - LInsert
Where - Where option for the
linsertcommand. - LMove
Where - Where option for the
lmovecommand. - Latency
History Event - Latency history event for the
latency_graph&latency_historycommands. - Migrate
Result - Result for the
migratecommand - Quantization
Options - Quantization options for
vaddcommand. - Replica
OfOptions - options for the
replicaofcommand. - 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
rolecommand. - Script
Debug Mode - Options for the
script_debugcommand. - Sentinel
Simulate Failure Mode - Different crash simulation scenario modes for
the
sentinel_simulate_failurecommand - SetCondition
- Condition option for the
set_with_optionscommand - SetExpiration
- Expiration option for the
set_with_optionsandhsetexcommands - Sort
Order - Order option of the
sortcommand - TsAggregation
Type - Aggregation type for the
ts_createruleandts_mrangecommands. - TsDuplicate
Policy Policyfor handling samples with identical timestamps- TsEncoding
- specifies the series samples encoding format.
- TsTimestamp
- Timeseries Timestamp
- Vector
OrElement - Argument of the
vsimcommand - XTrim
Operator - Stream Trim operator for the
xaddandxtrimcommands - ZAdd
Comparison - Comparison option for the
zaddcommand - ZAdd
Condition - Condition option for the
zaddcommand - ZAggregate
- Option that specify how results of an union or intersection are aggregated
- ZRange
Sort By - sort by option of the
zrangecommand - ZWhere
- Where option of the
zmpopcommand
Traits§
- Bitmap
Commands - A group of Redis commands related to
Bitmaps&Bitfields - Blocking
Commands - A group of blocking commands
- Bloom
Commands - 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 - A group of Redis commands related to
Count-min Sketch - Cuckoo
Commands - A group of Redis commands related to
Cuckoo filters - Generic
Commands - A group of generic Redis commands
- GeoCommands
- A group of Redis commands related to
Geospatialindices - Hash
Commands - A group of Redis commands related to
Hashes - Hyper
LogLog Commands - A group of Redis commands related to
HyperLogLog - Json
Commands - 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 - 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 - A group of Redis commands related to
T-Digest - Time
Series Commands - A group of Redis commands related to
Time Series - TopK
Commands - A group of Redis commands related to
Top-K - Transaction
Commands - A group of Redis commands related to Transactions
- Vector
SetCommands - A group of Redis commands related to
Vector Sets
Functions§
Type Aliases§
- ZMPop
Result - Result for
zmpopthe command.