Skip to main content

CacheManager

Trait CacheManager 

Source
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)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn put<'life0, 'async_trait>(
        &'life0 self,
        cache_key: String,
        res: HttpResponse,
        policy: CachePolicy,
    ) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        cache_key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A trait providing methods for storing, reading, and removing cache records.

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, cache_key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<(HttpResponse, CachePolicy)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Attempts to pull a cached response and related policy from cache.

Source

fn put<'life0, 'async_trait>( &'life0 self, cache_key: String, res: HttpResponse, policy: CachePolicy, ) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Attempts to cache a response and related policy.

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, cache_key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Attempts to remove a record from cache.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl CacheManager for CACacheManager

Available on crate feature manager-cacache only.