[][src]Crate deadpool_redis

Deadpool simple async pool for Redis connections.

This crate implements a deadpool manager for redis.

You should not need to use deadpool directly. Use the Pool type provided by this crate instead.

Example

use std::env;

use deadpool_redis::{cmd, Manager, Pool};

#[tokio::main]
async fn main() {
    let mgr = Manager::new("redis://127.0.0.1/").unwrap();
    let pool = Pool::new(mgr, 16);
    {
        let mut conn = pool.get().await.unwrap();
        cmd("SET")
            .arg(&["deadpool/test_key", "42"])
            .execute(&mut conn)
            .await.unwrap();
    }
    {
        let mut conn = pool.get().await.unwrap();
        let value: String = cmd("GET")
            .arg(&["deadpool/test_key"])
            .query(&mut conn)
            .await.unwrap();
        assert_eq!(value, "42".to_string());
    }
}

Structs

Cmd

See redis::Cmd

Connection

A type alias for using deadpool::Object with redis

Manager

The manager for creating and recyling lapin connections

Pipeline

See redis::Pipeline

Functions

cmd

See redis::cmd

pipe

See redis::pipe

Type Definitions

Pool

A type alias for using deadpool::Pool with redis