34 releases

0.13.1 Apr 21, 2024
0.12.11 Apr 18, 2024
0.12.9 Mar 12, 2024
0.12.8 Dec 29, 2023
0.7.1 Dec 30, 2022

#69 in Database interfaces

Download history 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 253/week @ 2024-03-25 534/week @ 2024-04-01 317/week @ 2024-04-08 590/week @ 2024-04-15 355/week @ 2024-04-22 162/week @ 2024-04-29 86/week @ 2024-05-06

1,258 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–18MB
~271K SLoC