Expand description
Shared Redis / Valkey pool for Sova (KvStore, tasks, cache, pub/sub, list queues).
ⓘ
app.install(Redis::from_env());
let pool = app.try_state::<RedisPool>().unwrap().as_ref().clone();
pool.publish("events", b"hello").await?;
let mut sub = pool.subscribe(["events"]).await?;
while let Some(msg) = sub.next().await {
println!("{}: {:?}", msg.channel, msg.payload_str());
}
pool.enqueue("jobs", b"payload").await?;
let item = pool.dequeue("jobs").await?;Structs§
- Fake
Redis - Shared in-memory Redis (16 DBs, strings, pub/sub, SCAN).
- Fake
Subscriber - Redis
- Redis / Valkey pool plugin (
REDIS_URL). - Redis
Error - Redis
Message - One Pub/Sub delivery.
- Redis
Pool - Shared Redis handle filled during
on_startup(mirrors [sova_db::DbPool]). - Redis
Subscriber - Dedicated Pub/Sub connection (not shared with normal commands).
Traits§
- Redis
Ext - Convenient
req.redis().