Trait rust_cache::common::Cache
[−]
[src]
pub trait Cache { type Error; fn fetch<T: Cacheable>(&mut self, key: &String) -> Result<Option<T>, Self::Error>; fn save<T: Cacheable>(&mut self, key: &String, item: &T, ttl: Duration) -> Result<(), Self::Error>; fn delete(&mut self, key: &String) -> Result<(), Self::Error>; fn clear(&mut self) -> Result<(), Self::Error>; }
Trait to implement for actual cache implementations
Associated Types
type Error
Required Methods
fn fetch<T: Cacheable>(&mut self, key: &String) -> Result<Option<T>, Self::Error>
fn save<T: Cacheable>(&mut self, key: &String, item: &T, ttl: Duration) -> Result<(), Self::Error>
fn delete(&mut self, key: &String) -> Result<(), Self::Error>
fn clear(&mut self) -> Result<(), Self::Error>
Implementors
impl Cache for NullCache
impl Cache for HashMapCache