30 releases

0.12.9 Mar 12, 2024
0.12.8 Dec 29, 2023
0.12.2 Nov 30, 2023
0.11.1 May 27, 2023
0.7.1 Dec 30, 2022

#2 in #sentinel

Download history 81/week @ 2023-12-04 60/week @ 2023-12-11 102/week @ 2023-12-18 100/week @ 2023-12-25 158/week @ 2024-01-01 50/week @ 2024-01-08 79/week @ 2024-01-15 104/week @ 2024-01-22 166/week @ 2024-01-29 162/week @ 2024-02-05 545/week @ 2024-02-12 161/week @ 2024-02-19 311/week @ 2024-02-26 519/week @ 2024-03-04 281/week @ 2024-03-11 270/week @ 2024-03-18

1,406 downloads per month
Used in 2 crates

Custom license

1.5MB
36K 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–20MB
~284K SLoC