Cache backends
One trait, four backends.
The Cache trait abstracts the backend: InMemoryCache (one process, TTL + LRU bound), FileCache, DatabaseCache (tri-dialect), and RedisCache (feature cache-redis) for multi-replica deployments. Use get / set / get_or_set / incr / add.
let stats: Stats = get_or_set(&*cache, "home:stats",
|| async { compute(&pool).await.unwrap() },
Some(Duration::from_secs(60))).await?;