Struct generational_cache::cache::lru_cache::LRUCache
source · pub struct LRUCache<V, K, T, M> { /* private fields */ }Expand description
A generational-arena powered LRUCache implementation.
Implementations§
source§impl<V, K, T, M> LRUCache<V, K, T, M>where
V: Vector<LRUCacheBlockArenaEntry<K, T>>,
M: Map<K, Link>,
impl<V, K, T, M> LRUCache<V, K, T, M>where V: Vector<LRUCacheBlockArenaEntry<K, T>>, M: Map<K, Link>,
pub fn least_recent(&self) -> Option<(&K, &T)>
pub fn most_recent(&self) -> Option<(&K, &T)>
source§impl<V, K, T, M> LRUCache<V, K, T, M>where
V: Vector<LRUCacheBlockArenaEntry<K, T>>,
M: Map<K, Link>,
impl<V, K, T, M> LRUCache<V, K, T, M>where V: Vector<LRUCacheBlockArenaEntry<K, T>>, M: Map<K, Link>,
pub fn with_backing_vector_and_map(vector: V, map: M) -> Self
source§impl<V, K, T, M> LRUCache<V, K, T, M>where
V: Vector<LRUCacheBlockArenaEntry<K, T>>,
M: Map<K, Link> + Default,
impl<V, K, T, M> LRUCache<V, K, T, M>where V: Vector<LRUCacheBlockArenaEntry<K, T>>, M: Map<K, Link> + Default,
pub fn with_backing_vector(vector: V) -> Self
Trait Implementations§
source§impl<V, K, T, M> Cache<K, T> for LRUCache<V, K, T, M>where
V: Vector<LRUCacheBlockArenaEntry<K, T>>,
M: Map<K, Link>,
K: Copy,
impl<V, K, T, M> Cache<K, T> for LRUCache<V, K, T, M>where V: Vector<LRUCacheBlockArenaEntry<K, T>>, M: Map<K, Link>, K: Copy,
type Error = LRUCacheError<<V as Vector<Entry<Node<Block<K, T>>>>>::Error, <M as Map<K, Link>>::Error>
fn insert(&mut self, key: K, value: T) -> Result<Eviction<K, T>, Self::Error>
fn remove(&mut self, key: &K) -> Result<T, Self::Error>
fn query(&mut self, key: &K) -> Result<&T, Self::Error>
fn capacity(&self) -> usize
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn clear(&mut self) -> Result<(), Self::Error>
fn is_maxed(&self) -> bool
Auto Trait Implementations§
impl<V, K, T, M> RefUnwindSafe for LRUCache<V, K, T, M>where K: RefUnwindSafe, M: RefUnwindSafe, T: RefUnwindSafe, V: RefUnwindSafe,
impl<V, K, T, M> Send for LRUCache<V, K, T, M>where K: Send, M: Send, T: Send, V: Send,
impl<V, K, T, M> Sync for LRUCache<V, K, T, M>where K: Sync, M: Sync, T: Sync, V: Sync,
impl<V, K, T, M> Unpin for LRUCache<V, K, T, M>where K: Unpin, M: Unpin, T: Unpin, V: Unpin,
impl<V, K, T, M> UnwindSafe for LRUCache<V, K, T, M>where K: UnwindSafe, M: UnwindSafe, T: UnwindSafe, 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