Crates.io | tokio-valkey |
lib.rs | tokio-valkey |
version | |
source | src |
created_at | 2024-11-26 18:44:00.238765 |
updated_at | 2024-12-04 05:31:31.295505 |
description | An ergonomic, asynchronous Valkey driver |
homepage | |
repository | |
max_upload_size | |
id | 1462144 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A Valkey driver for Rust.
This project will include sync, async, and pooling. It is still a work-in-progress.
Synchronous:
use std::net::{Ipv6Addr, SocketAddr};
use valkey::Client;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = SocketAddr::from((Ipv6Addr::LOCALHOST, 6379));
let mut client = Client::connect(addr)?;
client.set("hello", "world")?;
let value = client.get("hello")?.unwrap();
println!("Hello {value}");
Ok(())
}
Async:
use std::net::{Ipv6Addr, SocketAddr};
use tokio_valkey::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = SocketAddr::from((Ipv6Addr::LOCALHOST, 6379));
let mut client = Client::connect(addr).await?;
client.set("hello", "world").await?;
let value = client.get("hello").await?.unwrap();
println!("Hello {value}");
Ok(())
}
Use valkey for sync and tokio-valkey for async.