Struct akd::storage::timed_cache::TimedCache
source · [−]pub struct TimedCache { /* private fields */ }
Expand description
Implements a basic cahce with timing information which automatically flushes expired entries and removes them
Implementations
sourceimpl TimedCache
impl TimedCache
sourcepub async fn log_metrics(&self, level: Level)
pub async fn log_metrics(&self, level: Level)
Log cache access metrics along with size information
sourceimpl TimedCache
impl TimedCache
sourcepub fn new(o_lifetime: Option<Duration>) -> Self
pub fn new(o_lifetime: Option<Duration>) -> Self
Create a new timed cache instance. You can supply an optional item lifetime parameter or take the default (30s)
sourcepub async fn hit_test<St: Storable>(&self, key: &St::Key) -> Option<DbRecord>
pub async fn hit_test<St: Storable>(&self, key: &St::Key) -> Option<DbRecord>
Perform a hit-test of the cache for a given key. If successful, Some(record) will be returned
sourcepub async fn batch_put(&self, records: &[DbRecord])
pub async fn batch_put(&self, records: &[DbRecord])
Put a batch of items into the cache, utilizing a single write lock
sourcepub async fn disable_clean(&self)
pub async fn disable_clean(&self)
Disable cache-cleaning (i.e. during a transaction)
sourcepub async fn enable_clean(&self)
pub async fn enable_clean(&self)
Re-enable cache cleaning (i.e. when a transaction is over)
Trait Implementations
sourceimpl Clone for TimedCache
impl Clone for TimedCache
Auto Trait Implementations
impl !RefUnwindSafe for TimedCache
impl Send for TimedCache
impl Sync for TimedCache
impl Unpin for TimedCache
impl !UnwindSafe for TimedCache
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more