pub struct Cache<K, D> { /* private fields */ }Implementations§
Source§impl<K: Eq + Hash + Clone, D: Default + Clone> Cache<K, D>
impl<K: Eq + Hash + Clone, D: Default + Clone> Cache<K, D>
pub fn new( size: usize, miss_handler: MissHandler<K, D>, positive_ttl: Duration, negative_ttl: Duration, ) -> Self
pub fn insert(&self, key: &K, data: D)
pub fn get(&self, key: &K) -> Option<D>
pub fn update(&self, key: &K, data: D) -> bool
pub fn len(&self) -> usize
pub fn retrieve_or_compute(&self, key: &K) -> Option<(D, u8, bool)>
pub fn retrieve_or_compute_with_params( &self, key: &K, params: &[&dyn Any], ) -> Option<(D, u8, bool)>
Auto Trait Implementations§
impl<K, D> Freeze for Cache<K, D>
impl<K, D> RefUnwindSafe for Cache<K, D>
impl<K, D> Send for Cache<K, D>
impl<K, D> Sync for Cache<K, D>
impl<K, D> Unpin for Cache<K, D>
impl<K, D> UnwindSafe for Cache<K, D>
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