pub struct QueryCache<V> { /* private fields */ }Expand description
Cache mapping query keys to results.
Implementations§
Source§impl<V: Clone> QueryCache<V>
impl<V: Clone> QueryCache<V>
pub fn new(default_ttl: u32) -> Self
pub fn insert(&mut self, key: &str, value: V)
pub fn insert_with_ttl(&mut self, key: &str, value: V, ttl: u32)
pub fn get(&mut self, key: &str) -> Option<&V>
pub fn peek(&self, key: &str) -> Option<&V>
pub fn contains(&self, key: &str) -> bool
pub fn remove(&mut self, key: &str) -> bool
pub fn tick(&mut self)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn hit_rate(&self) -> f64
pub fn total_hits(&self) -> u64
pub fn total_misses(&self) -> u64
pub fn clear(&mut self)
pub fn keys(&self) -> Vec<&str>
Auto Trait Implementations§
impl<V> Freeze for QueryCache<V>
impl<V> RefUnwindSafe for QueryCache<V>where
V: RefUnwindSafe,
impl<V> Send for QueryCache<V>where
V: Send,
impl<V> Sync for QueryCache<V>where
V: Sync,
impl<V> Unpin for QueryCache<V>where
V: Unpin,
impl<V> UnsafeUnpin for QueryCache<V>
impl<V> UnwindSafe for QueryCache<V>where
V: 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