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

#50 in Database interfaces

Download history 769/week @ 2024-08-15 1048/week @ 2024-08-22 604/week @ 2024-08-29 910/week @ 2024-09-05 771/week @ 2024-09-12 820/week @ 2024-09-19 1121/week @ 2024-09-26 1078/week @ 2024-10-03 727/week @ 2024-10-10 2531/week @ 2024-10-17 1910/week @ 2024-10-24 1794/week @ 2024-10-31 2532/week @ 2024-11-07 1929/week @ 2024-11-14 1585/week @ 2024-11-21 1542/week @ 2024-11-28

8,061 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
~246K SLoC