| Crates.io | rustis |
| lib.rs | rustis |
| version | 0.16.1 |
| created_at | 2022-12-01 19:33:50.132004+00 |
| updated_at | 2025-07-11 07:52:40.950997+00 |
| description | Redis async driver for Rust |
| homepage | https://github.com/dahomey-technologies/rustis |
| repository | https://github.com/dahomey-technologies/rustis |
| max_upload_size | |
| id | 727859 |
| size | 1,996,107 |
An asynchronous Redis client for Rust.
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(())
}
redis directory, run docker_up.sh or docker_up.cmdcargo test --features pool,tokio-rustls,json,client-cache (Tokio runtime)cargo test --no-default-features --features async-std-runtime,async-std-native-tls,json,client-cache (async-std runtime)cargo fmt --all -- --checkredis directory, run docker_up.sh or docker_up.cmdcargo bench