Crate basteh_redis
source ·Expand description
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");
}
Structs
- Holds the connection information that redis should use for connecting.
- An implementation of
ExpiryStore
based on redis using redis-rs async runtime - Redis specific/connection independent information used to establish a connection to redis.
- Represents a redis error. For the most part you should be using the Error trait to interact with this rather than the actual struct.
Enums
- Defines the connection address.
- An enum of all error kinds.