Struct simple_disk_cache::SimpleCache
[−]
[src]
pub struct SimpleCache<K, V> where
K: Clone + Eq + Hash + Serialize + DeserializeOwned, { /* fields omitted */ }
Methods
impl<K, V> SimpleCache<K, V> where
K: DeserializeOwned + Serialize + Clone + Eq + Hash,
V: DeserializeOwned + Serialize,
[src]
K: DeserializeOwned + Serialize + Clone + Eq + Hash,
V: DeserializeOwned + Serialize,
pub fn initialize<P: Into<PathBuf>>(
data_dir: P,
config: CacheConfig
) -> Result<Self, CacheError>
[src]
data_dir: P,
config: CacheConfig
) -> Result<Self, CacheError>
pub fn get(&mut self, key: &K) -> Result<Option<V>, CacheError>
[src]
Try getting a value from the cache.
Unless there is an error, this will either return Ok(Some(value))
if a value was found,
or Ok(None)
if no value for the key exists in the cache.
pub fn put(&mut self, key: &K, value: &V) -> Result<(), CacheError>
[src]
Insert a value into the cache.
If the key already exists, the previous value will be overwritten.
Trait Implementations
Auto Trait Implementations
impl<K, V> Send for SimpleCache<K, V> where
K: Send + Sync,
V: Send,
K: Send + Sync,
V: Send,
impl<K, V> Sync for SimpleCache<K, V> where
K: Send + Sync,
V: Sync,
K: Send + Sync,
V: Sync,