pub struct CacheStore { /* private fields */ }Expand description
A cache store backed by a Vec of entries.
Implementations§
Source§impl CacheStore
impl CacheStore
pub fn new(capacity: usize) -> Self
pub fn advance_time(&mut self, ms: u64)
pub fn put(&mut self, key: &str, value: Vec<u8>, ttl_ms: u64)
pub fn get(&mut self, key: &str) -> Option<&[u8]>
pub fn contains(&self, key: &str) -> bool
pub fn remove(&mut self, key: &str) -> bool
pub fn evict_expired(&mut self)
pub fn count(&self) -> usize
pub fn capacity(&self) -> usize
pub fn clear(&mut self)
pub fn total_bytes(&self) -> usize
pub fn most_accessed(&self) -> Option<&str>
Trait Implementations§
Source§impl Clone for CacheStore
impl Clone for CacheStore
Source§fn clone(&self) -> CacheStore
fn clone(&self) -> CacheStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CacheStore
impl RefUnwindSafe for CacheStore
impl Send for CacheStore
impl Sync for CacheStore
impl Unpin for CacheStore
impl UnsafeUnpin for CacheStore
impl UnwindSafe for CacheStore
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