#redis #storage #async #web

basteh-redis

An implementation of basteh based on redis-rs

2 releases

0.4.0-alpha.5 Mar 6, 2023
0.4.0-alpha.4 Feb 6, 2023
0.4.0-alpha.2 Feb 1, 2023

#229 in #redis

24 downloads per month

MIT/Apache

80KB
1.5K SLoC

basteh-redis

This crate provides an implementation for basteh based on redis.

Please refer to basteh crate documentations for full details about usage and use cases.

RedisBackend

RedisBackend is a full store with expiration implementation.

use basteh_redis::{RedisBackend, ConnectionInfo, RedisConnectionInfo, ConnectionAddr};

async fn my_main() {
    // Connecting to the redis instance on localhost without username/password(for dev env)
    let store = RedisBackend::connect_default().await.expect("Redis connection failed");
    // OR connect with the provided redis::ConnectionInfo
    let connection_info = ConnectionInfo {
        addr: ConnectionAddr::Tcp("127.0.0.1".to_string(), 1234).into(),
        redis: RedisConnectionInfo{
            db: 0,
            username: Some("god".to_string()),
            password: Some("bless".to_string()),
        }
    };
    let store = RedisBackend::connect(connection_info).await.expect("Redis connection failed");
}

Dependencies

~6–19MB
~273K SLoC