1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/*!
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](https://redis.io/commands/).
Depending on the group of commands, traits will be implemented by [`Client`](crate::client::Client),
[`Pipeline`](crate::client::Pipeline), [`Transaction`](crate::client::Transaction) or some of these structs.
These is the list of existing command traits:
* [`ArrayCommands`] — [Arrays](https://redis.io/docs/latest/commands/?group=array), the sparse index-addressed type introduced in Redis 8.8
* [`BitmapCommands`] — [Bitmaps](https://redis.io/docs/data-types/bitmaps/) & [Bitfields](https://redis.io/docs/data-types/bitfields/)
* [`BlockingCommands`] — commands that block the connection until the Redis server
has a new element to send. Implemented only by [`ExclusiveClient`](crate::client::ExclusiveClient),
which owns its connection.
* [`ClusterCommands`] — [Redis cluster](https://redis.io/docs/reference/cluster-spec/)
* [`ConnectionCommands`] — connection management like authentication or RESP version management
* [`GenericCommands`] — generic commands like deleting, renaming or expiring keys
* [`GeoCommands`] — [Geospatial](https://redis.io/docs/data-types/geospatial/) indices
* [`HashCommands`] — [Hashes](https://redis.io/docs/data-types/hashes/)
* [`HyperLogLogCommands`] — [HyperLogLog](https://redis.io/docs/data-types/hyperloglogs/)
* [`ListCommands`] — [Lists](https://redis.io/docs/data-types/lists/)
* [`PubSubCommands`] — [Pub/Sub](https://redis.io/docs/manual/pubsub/)
* [`ScriptingCommands`] — [Scripts](https://redis.io/docs/manual/programmability/eval-intro/) &
[Functions](https://redis.io/docs/manual/programmability/functions-intro/)
* [`SentinelCommands`] — [Sentinel](https://redis.io/docs/management/sentinel/)
* [`ServerCommands`] — server management like [Access Control Lists](https://redis.io/docs/management/security/acl/) or monitoring
* [`SetCommands`] — [Sets](https://redis.io/docs/data-types/sets/)
* [`SortedSetCommands`] — [Sorted sets](https://redis.io/docs/data-types/sorted-sets/)
* [`StreamCommands`] — [Streams](https://redis.io/docs/data-types/streams/)
* [`StringCommands`] — [Strings](https://redis.io/docs/data-types/strings/)
* [`VectorSetCommands`] — [Vector sets](https://redis.io/docs/data-types/vector-sets/)
* [`TransactionCommands`] — `WATCH`/`UNWATCH`, the optimistic locking half of
[Transactions](https://redis.io/docs/manual/transactions/). Implemented only by
[`ExclusiveClient`](crate::client::ExclusiveClient), the watched state being a property
of the connection; `MULTI`/`EXEC` are reached through
[`Client::create_transaction`](crate::client::Client::create_transaction).
* [`BloomCommands`] — [Bloom filters](https://redis.io/docs/stack/bloom/)
* [`CuckooCommands`] — [Cuckoo filters](https://redis.io/docs/stack/bloom/)
* [`CountMinSketchCommands`] — [Count min-sketch](https://redis.io/docs/stack/bloom/)
* [`JsonCommands`] — [RedisJson](https://redis.io/docs/stack/json/)
* [`SearchCommands`] — [RedisSearch](https://redis.io/docs/stack/search/)
* [`TDigestCommands`] — [T-Digest](https://redis.io/docs/stack/bloom/)
* [`TimeSeriesCommands`] — [Time Series](https://redis.io/docs/stack/timeseries/)
* [`TopKCommands`] — [Top-K](https://redis.io/docs/stack/bloom/)
# Command coverage
Every command documented on [redis.io](https://redis.io/commands/) up to and
including **Redis 8.8** is implemented, together with its options — including
the commands of the bundled modules (RediSearch, RedisJSON, RedisTimeSeries,
RedisBloom, vector sets).
Three families are left out on purpose.
**Deprecated commands.** Their modern replacement is implemented instead, so
there is one way to do each thing rather than two:
| Deprecated | Use instead |
|---|---|
| `ZREVRANGE`, `ZRANGEBYSCORE`, `ZRANGEBYLEX`, `ZREVRANGEBYSCORE`, `ZREVRANGEBYLEX` | [`zrange`](SortedSetCommands::zrange) with [`ZRangeOptions`] |
| `RPOPLPUSH`, `BRPOPLPUSH` | [`lmove`](ListCommands::lmove), [`blmove`](BlockingCommands::blmove) |
| `GEORADIUS`, `GEORADIUSBYMEMBER`, and their `_RO` variants | [`geosearch`](GeoCommands::geosearch) |
| `HMSET` | [`hset`](HashCommands::hset) |
| `SLAVEOF` | [`replicaof`](ServerCommands::replicaof) |
| `CLUSTER SLAVES` | [`cluster_replicas`](ClusterCommands::cluster_replicas) |
| `FT.ADD`, `FT.DEL`, `FT.GET`, `FT.MGET`, `FT.DROP`, `FT.SAFEADD`, `FT.SYNADD` | the hash/JSON document model ([`ft_create`](SearchCommands::ft_create), [`ft_search`](SearchCommands::ft_search)) |
**Server-internal commands**, such as `PSYNC`, `SYNC`, `REPLCONF`,
`RESTORE-ASKING`, `PFDEBUG`, `BF.DEBUG`, `CF.DEBUG` or `_FT.DEBUG`. These belong
to the server-to-server or debugging surface; issuing them from a client can
corrupt replication or cluster state.
**Commands the server declares unstable.** The `COLLECT` reducer of
`FT.AGGREGATE` and `FT.HYBRID` is documented, but the search module refuses it
unless `search-enable-unstable-features` is set to `yes` — which means Redis
reserves the right to change its grammar and its reply. It is not exposed while
that is the case, rather than pin a public API to an interface its own vendor
calls provisional.
Note also that a handful of commands appear in `COMMAND LIST` without being
public API — a module's private surface, recognizable by the absence of any
documentation page. Those are not implemented either.
Transactions need no `DISCARD`: a [`Transaction`](crate::client::Transaction) is
buffered client-side and sent as a single `MULTI` … `EXEC` batch when
[`execute`](crate::client::Transaction::execute) is called, so abandoning one is
simply dropping it — nothing has reached the server yet.
# 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](crate::client::ClientPreparedCommand::forget).
```
use rustis::{
client::{Client, ClientPreparedCommand},
commands::{ListCommands, SortedSetCommands, ZAddOptions},
Result,
};
#[tokio::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](https://github.com/redis/redis-doc) with the
following [COPYRIGHT](https://github.com/redis/redis-doc/blob/master/COPYRIGHT).
*/
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;