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
/*!
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:
* [`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. This trait is implemented only by the [`Client`](crate::client::Client) struct.
* [`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`](HashCommands): [Hashes](https://redis.io/docs/data-types/hashes/)
* [`HyperLogLogCommands`](HyperLogLogCommands): [HyperLogLog](https://redis.io/docs/data-types/hyperloglogs/)
* [`ListCommands`](ListCommands): [Lists](https://redis.io/docs/data-types/lists/)
* [`PubSubCommands`](PubSubCommands): [Pub/Sub](https://redis.io/docs/manual/pubsub/)
* [`ScriptingCommands`](ScriptingCommands): [Scripts](https://redis.io/docs/manual/programmability/eval-intro/) &
[Functions](https://redis.io/docs/manual/programmability/functions-intro/)
* [`SentinelCommands`](SentinelCommands): [Sentinel](https://redis.io/docs/management/sentinel/)
* [`ServerCommands`](ServerCommands): Server management like [Access Control Lists](https://redis.io/docs/management/security/acl/) or monitoring
* [`SetCommands`](SetCommands): [Sets](https://redis.io/docs/data-types/sets/)
* [`SortedSetCommands`](SortedSetCommands): [Sorted sets](https://redis.io/docs/data-types/sorted-sets/)
* [`StreamCommands`](StreamCommands): [Streams](https://redis.io/docs/data-types/streams/)
* [`StringCommands`](StringCommands): [Strings](https://redis.io/docs/data-types/strings/)
* [`VectorSetCommands`](VectorSetCommands): [Vector sets](https://redis.io/docs/data-types/vector-sets/)
* [`TransactionCommands`](TransactionCommands): [Transactions](https://redis.io/docs/manual/transactions/)
* [`BloomCommands`](BloomCommands): [Bloom filters](https://redis.io/docs/stack/bloom/)
* [`CuckooCommands`](CuckooCommands): [Cuckoo filters](https://redis.io/docs/stack/bloom/)
* [`CountMinSketchCommands`](CountMinSketchCommands): [Count min-sketch](https://redis.io/docs/stack/bloom/)
* [`JsonCommands`](JsonCommands): [RedisJson](https://redis.io/docs/stack/json/)
* [`SearchCommands`](SearchCommands): [RedisSearch](https://redis.io/docs/stack/search/)
* [`TDigestCommands`](TDigestCommands): [T-Digest](https://redis.io/docs/stack/bloom/)
* [`TimeSeriesCommands`](TimeSeriesCommands): [Time Series](https://redis.io/docs/stack/timeseries/)
* [`TopKCommands`](TopKCommands): [Top-K](https://redis.io/docs/stack/bloom/)
# 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,
};
#[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](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 *;