redis_adapter
Module[Redis]: entries as fields of Redis hashes, over a redis-rs connection.
Contents
use utopia_cache::Redis;Rust
pub struct Redis<C = ConnectionManager, K = Json>Entries as fields of Redis hashes: key names the hash and hash the
field (the key itself by default), each value an Envelope. Supports
batches of fields, generation leases (crate::lease) and retries of
commands that failed on the connection.
Rust
use php_std::types::Value;
use utopia_cache::{Adapter, Redis};
let client = redis::Client::open("redis://localhost:6379")?;
let cache = Redis::new(client.get_connection_manager().await?);
cache.save("docs:user:1", &Value::from("Ada"), "", 0).await?;
assert_eq!(cache.load("docs:user:1", 60, "").await?, Some(Value::from("Ada")));
cache.purge("docs:user:1", "").await?;Compiles in CI; needs a running service to execute.
Also implements
Transport.