1 unstable release

0.1.0 Jan 23, 2022

#2840 in Database interfaces

MIT/Apache

165KB
3.5K SLoC

Undis

badge-github badge-crates.io badge-docs.rs badge-ci

Undis is a serde-compatible redis library for Rust.

Sending a request

For most use cases the Client is the only thing you need to know.

use undis::Client;
use serde::{Serialize, Deserialize};

#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct Table {
    foo: String,
    bar: i32,
    baz: bool,
}

let client = Client::new(20, addr).await?;

let value = Table { foo: "foo".into(), bar: 42, baz: true };
client.hset("my-key", &value).await?;
let fetched: Table = client.hmget("my-key").await?;

assert_eq!(value, fetched);

Sending a custom request

You may want to send some requests which are not supported as a method. This is possible using raw_command.

let res: MyStruct = client.raw_command(("CUSTOMCOMMAND", "ARG1", 42, "ARG2", "FOO")).await?;

Future topics

  • Pubsub.
  • Pipeline.
  • Separate the resp3 module into its own crate, with better multi-crate project layout.
  • Redis server mock helper.
  • Full-featured Redis server implementation.
  • Redis cluster proxy.

License

Undis is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~5–17MB
~169K SLoC