pub trait CacheManager:
Send
+ Sync
+ 'static {
// Required methods
fn get(
&self,
cache_key: &str,
) -> impl Future<Output = Result<Option<(HttpResponse, CachePolicy)>, Box<dyn Error + Send + Sync>>> + Send;
fn put(
&self,
cache_key: String,
res: HttpResponse,
policy: CachePolicy,
) -> impl Future<Output = Result<HttpResponse, Box<dyn Error + Send + Sync>>> + Send;
fn delete(
&self,
cache_key: &str,
) -> impl Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + 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)>, Box<dyn Error + Send + Sync>>> + Send
fn get( &self, cache_key: &str, ) -> impl Future<Output = Result<Option<(HttpResponse, CachePolicy)>, Box<dyn Error + Send + Sync>>> + 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, Box<dyn Error + Send + Sync>>> + Send
fn put( &self, cache_key: String, res: HttpResponse, policy: CachePolicy, ) -> impl Future<Output = Result<HttpResponse, Box<dyn Error + Send + Sync>>> + 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".