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)>>> + 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§

Source

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.

Source

fn put( &self, cache_key: String, res: HttpResponse, policy: CachePolicy, ) -> impl Future<Output = Result<HttpResponse>> + Send

Attempts to cache a response and related policy.

Source

fn delete(&self, cache_key: &str) -> impl Future<Output = Result<()>> + 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", so this trait is not object safe.

Implementors§

Source§

impl CacheManager for CACacheManager

Available on crate features manager-cacache or manager-cacache-bincode only.