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§
Sourcefn get(&self, key: &str) -> Option<CachedResponse>
fn get(&self, key: &str) -> Option<CachedResponse>
What is held under key, if anything.
Sourcefn set(&self, key: &str, response: CachedResponse)
fn set(&self, key: &str, response: CachedResponse)
Holds a response under key, replacing whatever was there.
Sourcefn invalidate(&self, key: &str)
fn invalidate(&self, key: &str)
Forgets what is held under key.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".