[−][src]Struct multicache::MultiCache
Methods
impl<K, V> MultiCache<K, V>
[src]
pub fn new(bytesize: usize) -> MultiCache<K, V> where
K: Hash + Eq,
[src]
K: Hash + Eq,
Create a new cache which will at most hold a total of bytesize in elements
pub fn put(&self, key: K, value: V, bytes: usize) where
K: Hash + Eq,
[src]
K: Hash + Eq,
Add a new element by key/value with a given bytesize, if after inserting this element we would be going over the bytesize of the cache first enough elements are evicted for that to not be the case
pub fn put_arc(&self, key: K, value: Arc<V>, bytes: usize) where
K: Hash + Eq,
[src]
K: Hash + Eq,
Add a new element by key/Arc
pub fn get(&self, key: &K) -> Option<Arc<V>> where
K: Hash + Eq,
[src]
K: Hash + Eq,
Get an element from the cache, updating it so it's now the most recently used and thus the last to be evicted
pub fn remove(&self, key: &K) -> Option<Arc<V>> where
K: Hash + Eq,
[src]
K: Hash + Eq,
Remove an element from the cache, returning it if it exists
pub fn contains_key(&self, key: &K) -> bool where
K: Hash + Eq,
[src]
K: Hash + Eq,
Check if a given key exists in the cache
Trait Implementations
impl<K: Debug, V: Debug> Debug for MultiCache<K, V>
[src]
Auto Trait Implementations
impl<K, V> RefUnwindSafe for MultiCache<K, V>
impl<K, V> Send for MultiCache<K, V> where
K: Send,
V: Send + Sync,
K: Send,
V: Send + Sync,
impl<K, V> Sync for MultiCache<K, V> where
K: Send,
V: Send + Sync,
K: Send,
V: Send + Sync,
impl<K, V> Unpin for MultiCache<K, V>
impl<K, V> UnwindSafe for MultiCache<K, V>
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,
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.
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>,