pub trait CacheManager:
Send
+ Sync
+ 'static {
// Required methods
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cache_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(HttpResponse, CachePolicy)>, Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn put<'life0, 'async_trait>(
&'life0 self,
cache_key: String,
res: HttpResponse,
policy: CachePolicy,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse, Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
cache_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}
Expand description
A trait providing methods for storing, reading, and removing cache records.
Required Methods§
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cache_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(HttpResponse, CachePolicy)>, Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cache_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(HttpResponse, CachePolicy)>, Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Attempts to pull a cached response and related policy from cache.
Sourcefn put<'life0, 'async_trait>(
&'life0 self,
cache_key: String,
res: HttpResponse,
policy: CachePolicy,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse, Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
cache_key: String,
res: HttpResponse,
policy: CachePolicy,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse, Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Attempts to cache a response and related policy.