Struct memory_cache::MemoryLruCache [−][src]
An LRU-cache which operates on memory used.
Implementations
impl<K: Eq + Hash, V: MallocSizeOf> MemoryLruCache<K, V>
[src]
pub fn new(max_size: usize) -> Self
[src]
Create a new cache with a maximum size in bytes.
pub fn insert(&mut self, key: K, val: V)
[src]
Insert an item.
pub fn get_mut(&mut self, key: &K) -> Option<&mut V>
[src]
Get a reference to an item in the cache. It is a logic error for its heap size to be altered while borrowed.
pub fn current_size(&self) -> usize
[src]
Currently-used size of values in bytes.
pub fn backstore(&self) -> &LruCache<K, V>
[src]
Get backing LRU cache instance (read only)
Auto Trait Implementations
impl<K, V> RefUnwindSafe for MemoryLruCache<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for MemoryLruCache<K, V> where
K: Send,
V: Send,
K: Send,
V: Send,
impl<K, V> Sync for MemoryLruCache<K, V> where
K: Sync,
V: Sync,
K: Sync,
V: Sync,
impl<K, V> Unpin for MemoryLruCache<K, V>
impl<K, V> UnwindSafe for MemoryLruCache<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,