Trait salvo_cache::CacheStore
source · pub trait CacheStore: Send + Sync + 'static {
type Error: StdError + Sync + Send + 'static;
type Key: Hash + Eq + Send + Clone + 'static;
fn load_entry<'life0, 'life1, 'async_trait, Q>(
&'life0 self,
key: &'life1 Q
) -> Pin<Box<dyn Future<Output = Option<CachedEntry>> + Send + 'async_trait>>
where
Self::Key: Borrow<Q>,
Q: Hash + Eq + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn save_entry<'life0, 'async_trait>(
&'life0 self,
key: Self::Key,
data: CachedEntry
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where
Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Store cache.
Required Associated Types§
Required Methods§
sourcefn load_entry<'life0, 'life1, 'async_trait, Q>(
&'life0 self,
key: &'life1 Q
) -> Pin<Box<dyn Future<Output = Option<CachedEntry>> + Send + 'async_trait>>where
Self::Key: Borrow<Q>,
Q: Hash + Eq + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_entry<'life0, 'life1, 'async_trait, Q>(
&'life0 self,
key: &'life1 Q
) -> Pin<Box<dyn Future<Output = Option<CachedEntry>> + Send + 'async_trait>>where
Self::Key: Borrow<Q>,
Q: Hash + Eq + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the cache item from the store.
Implementors§
source§impl<K> CacheStore for MemoryStore<K>where
K: Hash + Eq + Send + Sync + Clone + 'static,
Available on crate feature memory-store
only.
impl<K> CacheStore for MemoryStore<K>where
K: Hash + Eq + Send + Sync + Clone + 'static,
Available on crate feature
memory-store
only.