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: StringsTransactionCommands: Transactions
Redis Stack commands:
BloomCommands: Bloom filtersCuckooCommands: Cuckoo filtersCountMinSketchCommands: Count min-sketchGraphCommands: RedisGraphJsonCommands: 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
- Options for the
acl_catcommand - Options for the
acl_dryruncommand - Options for the
acl_genpasscommand - Options for the
acl_logcommand - BfInfoResult
redis-bloomResult for thebf_infocommand. - BfInsertOptions
redis-bloomOptions for thebf_insertcommand. - BfReserveOptions
redis-bloomOptions for thebf_reservecommand. - BfScanDumpResult
redis-bloomResult for thebf_scandumpcommand. - Sub-command for the
bitfieldcommand - Interval options for the
bitcountcommand - Builder for calling a script/function for the following commands:
- CfInfoResult
redis-bloomResult for thecf_infocommand. - CfInsertOptions
redis-bloomOptions for thecf_insertcommand. - CfReserveOptions
redis-bloomOptions for thecf_reservecommand. - CfScanDumpResult
redis-bloomResult for thecf_scandumpcommand. - Client info results for the
client_info&client_listcommands. - Options for the
client-killcommand. - Options for the client_list command.
- Result for the
client_listcommand. - Result for the
client_trackinginfocommand. - Options for the
client_trackingcommand. - Result for the
cluster_infocommand - Result for the
cluster_linkscommand - Cluster node result for the
cluster_shardscommand. - Result for the
cluster_shardscommand. - CmsInfoResult
redis-bloomResult for thecms_infocommand. - Command doc result for the
command_docscommand - Command Histogram for the
latency_histogramcommands. - Command info result for the
commandcommand. - Options for the
command_listcommand. - Sub-result for the
memory_statscommand. - Result for the
dumpcommand. - sub-result for the
function_statscommand. - Options for the
failovercommand. - FtAggregateOptions
redis-searchOptions for theft_createcommand - FtAggregateResult
redis-searchResult for theft_aggregatecommand - FtCreateOptions
redis-searchOptions for theft_createcommand - FtCursorStats
redis-searchCursor stats for theft_infocommand - FtFieldSchema
redis-searchfield schema for theft_createcommand - FtFlatVectorFieldAttributes
redis-search - FtGcStats
redis-searchGarbage collector stats for theft_infocommand - FtHnswVectorFieldAttributes
redis-search - FtIndexAttribute
redis-searchIndex attribute info - FtIndexDefinition
redis-searchIndex definitin for theft_infocommand - FtInfoResult
redis-searchResult for theft_infocommand - FtLoadAttribute
redis-searchAttribute for theLOADaggregate option - FtMisspelledTerm
redis-searchMisspelled term + suggestions for theft_spellcheckcommand. - FtProfileAggregateResult
redis-searchResult for theft_profile_aggregatecommand. - FtProfileDetails
redis-searchResult details of aft_profile_searchorft_profile_aggregatecommand. - FtProfileSearchResult
redis-searchResult for theft_profile_searchcommand. - FtReducer
redis-searchReducer for thegroupbyaggregate option - FtResultProcessorsProfile
redis-searchResult processors profile for theft_profile_searchorft_profile_aggregatecommand. - FtSearchHighlightOptions
redis-search - FtSearchOptions
redis-searchOptions for theft_searchcommand. - FtSearchResult
redis-searchResult for theft_searchcommand - FtSearchResultRow
redis-searchA row in aFtSearchResult - FtSearchReturnAttribute
redis-search - FtSearchSummarizeOptions
redis-search - FtSortBy
redis-searchoption for thesortbyaggregate option - FtSpellCheckOptions
redis-searchOptions for theft_spellcheckcommand. - FtSpellCheckResult
redis-searchResult for theft_spellcheckcommand. - FtSugAddOptions
redis-searchOptions for theft_sugaddcommand. - FtSugGetOptions
redis-searchOptions for theft_suggetcommand. - FtSuggestion
redis-searchSugestion for theft_suggetcommand. - FtWithCursorOptions
redis-searchoptions for thewithcursoraggregate option - Result for the
function_dumpcommand. - Sub-result for the
function_listcommand. - Options for the
function_listcommand - Result for the
function_statscommand. - Options for the
geosearchcommand - Result of the
geosearchcommand. - Options for the
geosearchstorecommand - GraphEdge
redis-graphEdges (or Relationships) are persistent graph elements that connect one node to another. - GraphHeader
redis-graphHeader part of a graph ’result set` - GraphNode
redis-graphNodes are persistent graph elements that can be connected to each other via relationships. - GraphPath
redis-graphPaths are alternating sequences of nodes and edges, starting and ending with a node. - GraphProperties
redis-graph - GraphQueryOptions
redis-graphOptions for thegraph_querycommand - GraphQueryStatistics
redis-graphStatistics part of a graph ’result set` - GraphResultRow
redis-graphResult row for thegraph_querycommand - GraphResultRowSeed
redis-graph - GraphResultSet
redis-graphResult set for thegraph_querycommand - GraphSlowlogResult
redis-graphResult for thegraph_slowlogcommand - Options for the
hscancommand - Result for the
hscancommand. - Options for the
hellocommand. - Result for the
hellocommand - Sub-result for the
command_docscommand - JsonArrIndexOptions
redis-jsonOptions for thejson_arrindexcommand - JsonGetOptions
redis-jsonOptions for thejson_getcommand - Key specifications of a command for the
commandcommand. - Part of the result for the
lcscommand - Result for the
lcscommand - Cluster node result for the
cluster_slotscommand. - Result for the
cluster_slotscommand. - Result for the
function_listcommand. - Options for the
lolwutcommand - Result for the
memory_statscommand. - Options for the
memory_usagecommand - Options for the
migratecommand. - Module information result for the
module_listcommand. - Options for the
module_loadcommand - Options for the
pingcommand. - Options for the
pub_sub_channelscommand - Represents a connected replicas to a master
- options for the
replicaofcommand. - Options for the
restorecommand - Sub-result for the
function_statscommand. - Options for the
sscancommand - Options for the
scancommand - Result for the
sentinel_sentinelscommand. - Result for the
sentinel_mastercommand. - /// Result for the
sentinel_replicascommand. - options for the
shutdowncommand. - Result
slowlog_getfor the command. - options for the
slowlog_getcommand. - Options for the
sortcommand - Result for the
xrangeand other associated commands. - TDigestInfoResult
redis-bloomResult for thetdigest_infocommand. - TDigestMergeOptions
redis-bloomOptions for thetdigest_mergecommand. - TopKInfoResult
redis-bloomResult for thetopk_infocommand. - TopKListWithCountResult
redis-bloom - TsAddOptions
redis-time-seriesOptions for thets_addcommand. - TsCompactionRule
redis-time-seriesinformation about thecompaction rulesof a time series collection, in the context of thets_infocommand. - TsCreateOptions
redis-time-seriesOptions for thets_addcommand. - TsCreateRuleOptions
redis-time-seriesOptions for thets_createrulecommand. - TsGetOptions
redis-time-seriesOptions for thets_getcommand. - TsGroupByOptions
redis-time-seriesOptions for thets_mrangecommand. - TsIncrByDecrByOptions
redis-time-series - TsInfoChunkResult
redis-time-seriesAdditional debug result for thets_infocommand. - TsInfoResult
redis-time-seriesResult for thets_infocommand. - TsMGetOptions
redis-time-seriesOptions for thets_mgetcommand. - TsMRangeOptions
redis-time-seriesOptions for thets_mrangeandts_mrevrangecommands. - TsRangeOptions
redis-time-seriesOptions for thets_rangeandts_revrangecommands. - TsRangeSample
redis-time-seriesResult for thets_mrangeandts_mrevrangecommands. - TsSample
redis-time-seriesResult for thets_mgetcommand. - Stream Add options for the
xaddcommand. - Options for the
xautoclaimcommand - Result for the
xautoclaimcommand. - Options for the
xclaimcommand - Result entry for the
xinfo_consumerscommand. - Options for the
xgroup_createcommand - Result entry for the
xinfo_groupscommand. - Options for the
xinfo_streamcommand - Customer info result for the
xpendingcommand - Message result for the
xpending_with_optionscommand - Options for the
xpending_with_optionscommand - Result for the
xpendingcommand - Options for the
xreadgroupcommand - Options for the
xreadcommand - Stream info returned by the
xinfo_streamcommand. - Options for the
zaddcommand. - Options for the
zrangeandzrangestorecommands - Options for the
zscancommand - Result for the
zscancommand.
Enums
- Flag for a command argument
- The BeginSearch value of a specification informs the client of the extraction’s beginning
- BfInfoParameter
redis-bloomOptional parameter for thebf_infocommand. - Option for the
BitFieldSubCommandsub-command. - Sub-command for the
bitfieldcommand - Bit operation for the
bitopcommand. - Unit of a
range, bit or byte - Client caching mode for the
client_cachingcommand. - Mode options for the
client_pausecommand. - Mode options for the
client_replycommand. - Status options for the
client_trackingcommand. - Client type options for the
client_listcommand. - Mode options for the
client_unblockcommand. - Result for the
cluster_bumpepochcommand - Options for the
cluster_failovercommand - Cluster health status for the
cluster_shardscommand. - 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_setslotcommand. - Cluster state used in the
cluster_statefield ofClusterInfo - An argument must have one of the following types:
- Command documenation flag
- Get additional information about a command
- Options for the
expirecommand - The FindKeys value of a key specification tells the client how to continue the search for key names.
- Database flushing mode
- FtFieldType
redis-searchField type used to declare an index schema for theft_createcommand - FtIndexDataType
redis-searchRedis Data type of an index defined inFtCreateOptionsstruct - FtLanguage
redis-searchRedis search supported languages See.Supported Languages - FtPhoneticMatcher
redis-searchPhonetic algorithm and language used for theFtFieldSchema::phoneticassociated function - FtTermType
redis-searchTerm type for the optionterms - FtVectorDistanceMetric
redis-search - FtVectorFieldAlgorithm
redis-search - FtVectorType
redis-search - Policy option for the
function_restorecommand. - Condition for the
geoaddcommand - 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
getexcommand - GraphValue
redis-graphObject model for the differentRedisGraph Data Types - Section for the
infocommand. - Where option for the
linsertcommand. - Where option for the
lmovecommand. - Latency history event for the
latency_graph&latency_historycommands. - Result for the
migratecommand - 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
rolecommand. - Options for the
script_debugcommand. - Different crash simulation scenario modes for the
sentinel_simulate_failurecommand - Condition option for the
set_with_optionscommand - Expiration option for the
set_with_optionscommand - Order option of the
sortcommand - TsAggregationType
redis-time-seriesAggregation type for thets_createruleandts_mrangecommands. - TsDuplicatePolicy
redis-time-seriesPolicyfor handling samples with identical timestamps - TsEncoding
redis-time-seriesspecifies the series samples encoding format. - Comparison option for the
zaddcommand - Condition option for the
zaddcommand - Option that specify how results of an union or intersection are aggregated
- sort by option of the
zrangecommand - Where option of the
zmpopcommand
Traits
- A group of blocking commands
- BloomCommands
redis-bloomA 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-bloomA group of Redis commands related toCount-min Sketch - CuckooCommands
redis-bloomA group of Redis commands related toCuckoo filters - FromGraphValue
redis-graphUsed to doGraphValueto user type conversion while consuming the inputGraphValue - A group of generic Redis commands
- A group of Redis commands related to
Geospatialindices - GraphCommands
redis-graphA group of Redis commands related toRedisGraph - A group of Redis commands related to
Hashes - A group of Redis commands related to
HyperLogLog - JsonCommands
redis-jsonA 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-searchA 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-bloomA group of Redis commands related toT-Digest - TimeSeriesCommands
redis-time-seriesA group of Redis commands related toTime Series - TopKCommands
redis-bloomA group of Redis commands related toTop-K - A group of Redis commands related to Transactions
Functions
Type Aliases
- Result for
zmpopthe command.