36 releases

0.13.3 May 25, 2024
0.13.1 Apr 21, 2024
0.12.9 Mar 12, 2024
0.12.8 Dec 29, 2023
0.7.1 Dec 30, 2022

#52 in Database interfaces

Download history 341/week @ 2024-07-21 289/week @ 2024-07-28 105/week @ 2024-08-04 671/week @ 2024-08-11 827/week @ 2024-08-18 935/week @ 2024-08-25 838/week @ 2024-09-01 697/week @ 2024-09-08 820/week @ 2024-09-15 769/week @ 2024-09-22 1342/week @ 2024-09-29 794/week @ 2024-10-06 896/week @ 2024-10-13 2702/week @ 2024-10-20 1900/week @ 2024-10-27 2258/week @ 2024-11-03

7,792 downloads per month
Used in 4 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
~248K SLoC