framework_cqrs_lib/cqrs/infra/cache/mod.rs
1use moka::future::Cache;
2
3#[derive(Clone)]
4pub struct CacheAsync {
5 pub underlying: Cache<String, String>,
6}
7
8impl CacheAsync {
9 pub async fn get(&self, key: &String) -> Option<String> {
10 self.underlying.get(key).await
11 }
12
13 pub async fn upsert(&self, key: String, id: String) {
14 self.underlying.insert(key, id).await;
15 }
16}