Skip to content

Commit 5b5e4a0

Browse files
authored
feat: more commands and frames (#5)
1 parent 282e8b8 commit 5b5e4a0

File tree

7 files changed

+1230
-38
lines changed

7 files changed

+1230
-38
lines changed

README.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,87 @@
11
# redis-async
22

3-
An asynchronous Redis client library and a Redis CLI built in Rust, compliant with RESP 3 (Redis Serialization Protocol)
3+
An asynchronous Redis client library and a Redis CLI built in Rust, compliant with RES (Redis Serialization Protocol) 2 and 3, built with [Tokio][1].
4+
Inspired by [mini-redis][2].
45

56
## Usage
67

78
### Using the lib
89

10+
First import dependencies:
11+
12+
```TOML
13+
# in Cargo.toml
14+
[dependencies.redis-async]
15+
git = "https://github.com/aden-q/redis-async.git"
16+
```
17+
18+
Then use the lib in your Rust code:
19+
20+
```Rust
21+
use redis_async::{Client, Result};
22+
23+
#[tokio::main]
24+
async fn main() -> Result<()> {
25+
let mut client = Client::connect("127.0.0.1:6379").await?;
26+
27+
let _ = client.ping(Some("Hello, Redis!")).await?;
28+
29+
let _ = client.set("mykey", "myvalue").await?;
30+
31+
let _ = client.get("mykey").await?;
32+
33+
Ok(())
34+
}
35+
```
36+
37+
More examples can be found in the [examples](./examples/) directory.
38+
939
### Using the CLI
1040

41+
TBD. Not available yet.
42+
43+
## TLS/SSL
44+
45+
TBD. Not available yet.
46+
1147
## Connection pooling
1248

49+
TBD. Not available yet.
50+
1351
## Supported commands
1452

53+
This library is more on prototype. More commands will be added later on.
54+
55+
+ PING
56+
+ GET
57+
+ SET
58+
+ DEL
59+
+ EXISTS
60+
+ EXPIRE
61+
+ TTL
62+
+ INCR
63+
+ DECR
64+
+ LPUSH
65+
+ RPUSH
66+
+ LPOP
67+
+ RPOP
68+
+ LRANGE
69+
1570
## Development
1671

72+
TBD. Thinking of which may people prefer if they don't want to install Redis on their local.
73+
74+
Also due to gotchas from different RESP versions and Redis versions. A local dev may be necessary to for reproducible build and test environment.
75+
1776
### Docs
1877

1978
```shell
20-
cargo doc --no-deps --open
79+
> cargo doc --no-deps --open
2180
```
2281

2382
## License
2483

2584
The project is licensed under the [MIT license](./LICENSE).
85+
86+
[1]: https://tokio.rs/
87+
[2]: https://github.com/tokio-rs/mini-redis

examples/client_simple.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@ async fn main() -> Result<()> {
2020

2121
println!("DEL command response: {}", resp);
2222

23+
let resp = client.exists(vec!["mykey"]).await?;
24+
25+
println!("EXISTS command response: {}", resp);
26+
2327
Ok(())
2428
}

0 commit comments

Comments
 (0)