pub struct CacheBackend<K, V>{ /* private fields */ }Expand description
Backend to keep and manage stored entries.
A backend might remove entries at any point, e.g. due to memory pressure or expiration.
Implementations§
Source§impl<K, V> CacheBackend<K, V>
impl<K, V> CacheBackend<K, V>
pub fn new(policy: impl CachePolicy<K = K, V = V>) -> Self
Sourcepub fn peek(&mut self, k: &K) -> Option<V>
pub fn peek(&mut self, k: &K) -> Option<V>
Peek value for given key if it exists.
In contrast to get this will only return a value if there is a stored value.
This will not change the cache contents.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for CacheBackend<K, V>
impl<K, V> !RefUnwindSafe for CacheBackend<K, V>
impl<K, V> Send for CacheBackend<K, V>
impl<K, V> !Sync for CacheBackend<K, V>
impl<K, V> Unpin for CacheBackend<K, V>
impl<K, V> !UnwindSafe for CacheBackend<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