pub struct TtlPolicy<K, V> { /* private fields */ }Expand description
A simple time-to-live policy that removes only expired keys when the ttl is exceeded
Implementations§
Trait Implementations§
Source§impl<K, V> Policy<K, V> for TtlPolicy<K, V>
impl<K, V> Policy<K, V> for TtlPolicy<K, V>
Source§type Inner = TtlPolicyInner<K>
type Inner = TtlPolicyInner<K>
The inner type of this policy, likely behind a lock
Source§fn lock_inner(&self) -> MutexGuard<'_, Self::Inner>
fn lock_inner(&self) -> MutexGuard<'_, Self::Inner>
Panics Read more
fn get<S: BuildHasher>( &self, key: &K, cache: &LightCache<K, V, S, Self>, ) -> Option<V>
fn insert<S: BuildHasher>( &self, key: K, value: V, cache: &LightCache<K, V, S, Self>, ) -> Option<V>
fn remove<S: BuildHasher>( &self, key: &K, cache: &LightCache<K, V, S, Self>, ) -> Option<V>
fn lock_and_prune<S: BuildHasher>( &self, cache: &LightCache<K, V, S, Self>, ) -> MutexGuard<'_, Self::Inner>
Auto Trait Implementations§
impl<K, V> !Freeze for TtlPolicy<K, V>
impl<K, V> !RefUnwindSafe for TtlPolicy<K, V>
impl<K, V> Send for TtlPolicy<K, V>
impl<K, V> Sync for TtlPolicy<K, V>
impl<K, V> Unpin for TtlPolicy<K, V>
impl<K, V> UnwindSafe for TtlPolicy<K, V>where
V: UnwindSafe,
K: UnwindSafe,
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