pub trait CacheStore:
Send
+ Sync
+ 'static {
// Required methods
fn get<'a>(
&'a self,
key: &'a CacheKey,
) -> Pin<Box<dyn Future<Output = Result<Option<CacheEntry>, CacheError>> + Send + 'a>>;
fn set(
&self,
key: CacheKey,
entry: CacheEntry,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + '_>>;
fn delete<'a>(
&'a self,
key: &'a CacheKey,
) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'a>>;
fn delete_tag<'a>(
&'a self,
tag: &'a str,
) -> Pin<Box<dyn Future<Output = Result<usize, CacheError>> + Send + 'a>>;
fn clear(
&self,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + '_>>;
}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, ) -> Pin<Box<dyn Future<Output = Result<Option<CacheEntry>, CacheError>> + Send + 'a>>
fn set( &self, key: CacheKey, entry: CacheEntry, ) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + '_>>
fn delete<'a>( &'a self, key: &'a CacheKey, ) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'a>>
Sourcefn delete_tag<'a>(
&'a self,
tag: &'a str,
) -> Pin<Box<dyn Future<Output = Result<usize, CacheError>> + Send + 'a>>
fn delete_tag<'a>( &'a self, tag: &'a str, ) -> Pin<Box<dyn Future<Output = Result<usize, CacheError>> + Send + 'a>>
Delete every entry carrying tag; returns the number removed.
fn clear( &self, ) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + '_>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".