Skip to main content

Crate sova_redis

Crate sova_redis 

Source
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§

FakeRedis
Shared in-memory Redis (16 DBs, strings, pub/sub, SCAN).
FakeSubscriber
Redis
Redis / Valkey pool plugin (REDIS_URL).
RedisError
RedisMessage
One Pub/Sub delivery.
RedisPool
Shared Redis handle filled during on_startup (mirrors [sova_db::DbPool]).
RedisSubscriber
Dedicated Pub/Sub connection (not shared with normal commands).

Traits§

RedisExt
Convenient req.redis().