use super::super::super::{cache::*, key::*, response::*};
use std::{ops::*, sync::*};
pub type MokaCacheImplementation<CacheKeyT = CommonCacheKey> = Arc<moka::future::Cache<CacheKeyT, CachedResponseRef>>;
impl<CacheKeyT> Cache<CacheKeyT> for MokaCacheImplementation<CacheKeyT>
where
CacheKeyT: CacheKey,
{
async fn get(&self, key: &CacheKeyT) -> Option<CachedResponseRef> {
self.deref().get(key).await
}
async fn put(&self, key: CacheKeyT, cached_response: CachedResponseRef) {
self.deref().insert(key, cached_response).await
}
async fn invalidate(&self, key: &CacheKeyT) {
self.deref().invalidate(key).await
}
async fn invalidate_all(&self) {
self.deref().invalidate_all()
}
}