Skip to main content

CacheManager

Trait CacheManager 

Source
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§

Source

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.

Source

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.

Source

fn delete( &self, cache_key: &str, ) -> impl Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send

Attempts to remove a record from cache.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§