pub trait CacheManager:
Send
+ Sync
+ 'static {
// Required methods
fn get(
&self,
cache_key: &str,
) -> impl Future<Output = Result<Option<(HttpResponse, CachePolicy)>>> + Send;
fn put(
&self,
cache_key: String,
res: HttpResponse,
policy: CachePolicy,
) -> impl Future<Output = Result<HttpResponse>> + Send;
fn delete(&self, cache_key: &str) -> impl Future<Output = Result<()>> + Send;
}Expand description
A trait providing methods for storing, reading, and removing cache records.
Required Methods§
Sourcefn get(
&self,
cache_key: &str,
) -> impl Future<Output = Result<Option<(HttpResponse, CachePolicy)>>> + Send
fn get( &self, cache_key: &str, ) -> impl Future<Output = Result<Option<(HttpResponse, CachePolicy)>>> + Send
Attempts to pull a cached response and related policy from cache.
Sourcefn put(
&self,
cache_key: String,
res: HttpResponse,
policy: CachePolicy,
) -> impl Future<Output = Result<HttpResponse>> + Send
fn put( &self, cache_key: String, res: HttpResponse, policy: CachePolicy, ) -> impl Future<Output = Result<HttpResponse>> + Send
Attempts to cache a response and related policy.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl CacheManager for RedbManager
Available on crate feature
manager-redb only.