Skip to main content

ResponseCache

Trait ResponseCache 

Source
pub trait ResponseCache: Send + Sync {
    // Required methods
    fn get(&self, key: &str) -> Option<CachedResponse>;
    fn set(&self, key: &str, response: CachedResponse);
    fn invalidate(&self, key: &str);
    fn clear(&self);
}
Expand description

Stores JSON responses by ETag so a repeated read can be answered from a 304.

Required Methods§

Source

fn get(&self, key: &str) -> Option<CachedResponse>

What is held under key, if anything.

Source

fn set(&self, key: &str, response: CachedResponse)

Holds a response under key, replacing whatever was there.

Source

fn invalidate(&self, key: &str)

Forgets what is held under key.

Source

fn clear(&self)

Forgets everything.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§