bb8-valkey

Crates.iobb8-valkey
lib.rsbb8-valkey
version
sourcesrc
created_at2024-12-04 05:56:36.53743
updated_at2024-12-04 05:58:07.402524
descriptionA connection pool for Valkey
homepage
repository
max_upload_size
id1471280
Cargo.toml error:TOML parse error at line 17, column 1 | 17 | 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`
size0
Allan (allan2)

documentation

README

bb8-valkey

A connection pool for tokio-valkey.

It is still a work-in-progress.

Usage

use bb8::Pool;
use bb8_valkey::ValkeyConnectionManager;
use futures_util::future::join_all;
use std::net::{Ipv6Addr, SocketAddr};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let addr = SocketAddr::from((Ipv6Addr::LOCALHOST, 6379));
    let manager = ValkeyConnectionManager::new(addr).await?;
    let pool = Pool::builder().build(manager).await?;

    let mut handles = Vec::with_capacity(10);
    for _i in 0..10 {
        let pool = pool.clone();
        handles.push(tokio::spawn(async move {
            let mut conn = pool.get().await.unwrap();
        
            // this is not implemented yet
            let reply: String = cmd("PING").query_async(&mut *conn).await.unwrap();
            assert_eq!("PONG", reply);
        }));
    }
    join_all(handles).await;
    Ok(())
}
Commit count: 0

cargo fmt