pub trait Cache<K, V>: Send + Sync{
// Required methods
fn get(&self, key: &K) -> Option<V>;
fn put(&mut self, key: K, value: V) -> RragResult<()>;
fn remove(&mut self, key: &K) -> Option<V>;
fn contains(&self, key: &K) -> bool;
fn clear(&mut self);
fn size(&self) -> usize;
fn stats(&self) -> CacheStats;
}Expand description
Generic cache trait
Required Methods§
Sourcefn put(&mut self, key: K, value: V) -> RragResult<()>
fn put(&mut self, key: K, value: V) -> RragResult<()>
Put value into cache
Sourcefn stats(&self) -> CacheStats
fn stats(&self) -> CacheStats
Get cache statistics