pub trait CacheStore:
Send
+ Sync
+ 'static {
// Required methods
fn get<'a>(
&'a self,
key: &'a CacheKey,
) -> BoxFuture<'a, Result<Option<CacheEntry>, CacheError>>;
fn set(
&self,
key: CacheKey,
entry: CacheEntry,
) -> BoxFuture<'_, Result<(), CacheError>>;
fn delete<'a>(
&'a self,
key: &'a CacheKey,
) -> BoxFuture<'a, Result<bool, CacheError>>;
fn delete_tag<'a>(
&'a self,
tag: &'a str,
) -> BoxFuture<'a, Result<usize, CacheError>>;
fn clear(&self) -> BoxFuture<'_, Result<(), CacheError>>;
}Expand description
Storage backend.
Implementations must be safe to share between threads. Stale entries are
returned by get (stale-while-revalidate is decided by the caller).
Required Methods§
fn get<'a>( &'a self, key: &'a CacheKey, ) -> BoxFuture<'a, Result<Option<CacheEntry>, CacheError>>
fn set( &self, key: CacheKey, entry: CacheEntry, ) -> BoxFuture<'_, Result<(), CacheError>>
fn delete<'a>( &'a self, key: &'a CacheKey, ) -> BoxFuture<'a, Result<bool, CacheError>>
Sourcefn delete_tag<'a>(
&'a self,
tag: &'a str,
) -> BoxFuture<'a, Result<usize, CacheError>>
fn delete_tag<'a>( &'a self, tag: &'a str, ) -> BoxFuture<'a, Result<usize, CacheError>>
Delete every entry carrying tag; returns the number removed.
fn clear(&self) -> BoxFuture<'_, Result<(), CacheError>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".