pub trait IOCached<K, V> {
    type Error;
    fn cache_get(&self, k: &K) -> Result<Option<V>, Self::Error>;
fn cache_set(&self, k: K, v: V) -> Result<Option<V>, Self::Error>;
fn cache_remove(&self, k: &K) -> Result<Option<V>, Self::Error>;
fn cache_set_refresh(&mut self, refresh: bool) -> bool; fn cache_lifespan(&self) -> Option<u64> { ... }
fn cache_set_lifespan(&mut self, _seconds: u64) -> Option<u64> { ... } }
Expand description

Cache operations on an io-connected store

Associated Types

Required methods

Attempt to retrieve a cached value

Insert a key, value pair and return the previous value

Remove a cached value

Set the flag to control whether cache hits refresh the ttl of cached values, returns the old flag value

Provided methods

Return the lifespan of cached values (time to eviction)

Set the lifespan of cached values, returns the old value

Implementors