22 releases (9 breaking)

0.12.1 Nov 9, 2023
0.11.1 May 27, 2023
0.10.2 Mar 28, 2023
0.7.1 Dec 30, 2022

#190 in Database interfaces

Download history 108/week @ 2023-08-06 192/week @ 2023-08-13 165/week @ 2023-08-20 173/week @ 2023-08-27 347/week @ 2023-09-03 268/week @ 2023-09-10 92/week @ 2023-09-17 65/week @ 2023-09-24 132/week @ 2023-10-01 98/week @ 2023-10-08 80/week @ 2023-10-15 147/week @ 2023-10-22 148/week @ 2023-10-29 197/week @ 2023-11-05 364/week @ 2023-11-12 211/week @ 2023-11-19

929 downloads per month
Used in 2 crates

Custom license

1.5MB
35K SLoC

An asynchronous Redis client for Rust.

Crate docs.rs Build License

Documentation

Official Documentation

Philosophy

  • Low allocations
  • Full async library
  • Lock free implementation
  • Rust idiomatic API
  • Multiplexing as a core feature

Features

Basic Usage

use rustis::{
     client::Client, 
     commands::{FlushingMode, ServerCommands, StringCommands},
     Result,
};

#[tokio::main]
async fn main() -> Result<()> {
     // Connect the client to a Redis server from its IP and port
     let client = Client::connect("127.0.0.1:6379").await?;
 
     // Flush all existing data in Redis
     client.flushdb(FlushingMode::Sync).await?;

     // sends the command SET to Redis. This command is defined in the StringCommands trait
     client.set("key", "value").await?;
 
     // sends the command GET to Redis. This command is defined in the StringCommands trait
     let value: String = client.get("key").await?;
     println!("value: {value:?}");

     Ok(())
}

Tests

  1. From the redis directory, run docker_up.sh or docker_up.cmd
  2. run cargo test --features pool,redis-stack,tokio-tls (Tokio runtime)
  3. run cargo test --no-default-features --features redis-stack,async-std-runtime,async-std-tls (async-std runtime)

Benchmarks

  1. From the redis directory, run docker_up.sh or docker_up.cmd
  2. run cargo bench

Dependencies

~6–18MB
~271K SLoC