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

#55 in Database interfaces

Download history 769/week @ 2024-09-11 643/week @ 2024-09-18 1255/week @ 2024-09-25 1046/week @ 2024-10-02 756/week @ 2024-10-09 2046/week @ 2024-10-16 1953/week @ 2024-10-23 1902/week @ 2024-10-30 2604/week @ 2024-11-06 1896/week @ 2024-11-13 1703/week @ 2024-11-20 1562/week @ 2024-11-27 1782/week @ 2024-12-04 1277/week @ 2024-12-11 963/week @ 2024-12-18 219/week @ 2024-12-25

4,735 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
~242K SLoC