pub struct DiskCache<K, V> { /* private fields */ }
Expand description
Cache store backed by disk
Implementations§
source§impl<K, V> DiskCache<K, V>
impl<K, V> DiskCache<K, V>
sourcepub fn new(cache_name: &str) -> DiskCacheBuilder<K, V>
pub fn new(cache_name: &str) -> DiskCacheBuilder<K, V>
Initialize a DiskCacheBuilder
pub fn remove_expired_entries(&self, connection: &Db)
Trait Implementations§
source§impl<K, V> IOCached<K, V> for DiskCache<K, V>
impl<K, V> IOCached<K, V> for DiskCache<K, V>
type Error = DiskCacheError
source§fn cache_get(&self, key: &K) -> Result<Option<V>, DiskCacheError>
fn cache_get(&self, key: &K) -> Result<Option<V>, DiskCacheError>
Attempt to retrieve a cached value Read more
source§fn cache_set(&self, key: K, value: V) -> Result<Option<V>, DiskCacheError>
fn cache_set(&self, key: K, value: V) -> Result<Option<V>, DiskCacheError>
Insert a key, value pair and return the previous value Read more
source§fn cache_remove(&self, key: &K) -> Result<Option<V>, DiskCacheError>
fn cache_remove(&self, key: &K) -> Result<Option<V>, DiskCacheError>
Remove a cached value Read more
source§fn cache_lifespan(&self) -> Option<u64>
fn cache_lifespan(&self) -> Option<u64>
Return the lifespan of cached values (time to eviction)
source§fn cache_set_lifespan(&mut self, seconds: u64) -> Option<u64>
fn cache_set_lifespan(&mut self, seconds: u64) -> Option<u64>
Set the lifespan of cached values, returns the old value
source§fn cache_set_refresh(&mut self, refresh: bool) -> bool
fn cache_set_refresh(&mut self, refresh: bool) -> bool
Set the flag to control whether cache hits refresh the ttl of cached values, returns the old flag value
Auto Trait Implementations§
impl<K, V> !RefUnwindSafe for DiskCache<K, V>
impl<K, V> Send for DiskCache<K, V>
impl<K, V> Sync for DiskCache<K, V>
impl<K, V> Unpin for DiskCache<K, V>
impl<K, V> !UnwindSafe for DiskCache<K, V>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more