Struct rust_cache::hash_map::HashMapCache [] [src]

pub struct HashMapCache {
    // some fields omitted
}

Methods

impl HashMapCache

This cache allows for in memory caching. this can be useful for really simple caching requirements where you dont want to have to use a filesystem or some external storage but still want caching

fn new() -> Self

Trait Implementations

impl Cache for HashMapCache

type Error = 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>