pub struct SizeCache { /* private fields */ }Expand description
Cache with a byte-size budget that evicts LRU entries.
Implementations§
Source§impl SizeCache
impl SizeCache
pub fn new(budget_bytes: usize) -> Self
pub fn insert(&mut self, key: &str, size_bytes: usize)
pub fn get(&mut self, key: &str) -> Option<&SizeCacheEntry>
pub fn remove(&mut self, key: &str) -> bool
pub fn contains(&self, key: &str) -> bool
pub fn used_bytes(&self) -> usize
pub fn budget_bytes(&self) -> usize
pub fn count(&self) -> usize
pub fn evictions(&self) -> u64
pub fn is_over_budget(&self) -> bool
pub fn clear(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SizeCache
impl RefUnwindSafe for SizeCache
impl Send for SizeCache
impl Sync for SizeCache
impl Unpin for SizeCache
impl UnsafeUnpin for SizeCache
impl UnwindSafe for SizeCache
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