Skip to main content

Module cache_redis

Module cache_redis 

Source
Expand description

Redis / Valkey cache adapter (feature = “redis”) Redis / Valkey CachePort adapter

Feature-gated behind redis. Uses [deadpool_redis] for async connection pooling and supports optional key-prefix namespacing so multiple tenants can share a single Redis instance without key collisions.

§Quick start

use stygian_graph::adapters::cache_redis::{RedisCache, RedisCacheConfig};
use stygian_graph::ports::CachePort;
use std::time::Duration;

let config = RedisCacheConfig {
    url: "redis://127.0.0.1:6379".into(),
    key_prefix: Some("myapp:".into()),
    default_ttl: Some(Duration::from_secs(3600)),
    pool_size: 8,
};
let cache = RedisCache::new(config)?;
cache.set("page:1", "html".into(), None).await?;

Structs§

RedisCache
Redis / Valkey backed CachePort adapter.
RedisCacheConfig
Configuration for RedisCache.