pub trait Cache<K, V>: Send + Sync {
// Required methods
fn get(&self, key: &K) -> Option<V>;
fn put(&self, key: K, value: V, ttl_secs: u64);
fn remove(&self, key: &K) -> Option<V>;
fn clear(&self);
}Expand description
Cache trait for storing and retrieving values with TTL
Required Methods§
Implementors§
impl<K, V> Cache<K, V> for MemoryCache
impl<K, V> Cache<K, V> for NoOpCache
impl<K: Hash + Eq + Clone + Send + Sync + 'static, V: Clone + Send + Sync + 'static> Cache<K, V> for MokaCacheImpl<K, V>
Available on non-WebAssembly and crate feature
moka only.impl<K: Hash + Eq + Clone + Send + Sync + Display, V: Clone + Send + Sync> Cache<K, V> for LruCacheImpl<K, V>
Available on crate feature
lru only.