framework_cqrs_lib/cqrs/infra/cache/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use moka::future::Cache;

#[derive(Clone)]
pub struct CacheAsync {
    pub underlying: Cache<String, String>,
}

impl CacheAsync {
    pub async fn get(&self, key: &String) -> Option<String> {
        self.underlying.get(key).await
    }

    pub async fn upsert(&self, key: String, id: String) {
        self.underlying.insert(key, id).await;
    }
}