pub enum EvictionPolicy {
Lru,
Lfu,
Fifo,
}Expand description
Eviction policy for the cache.
Determines which entry to evict when the cache reaches capacity.
Variants§
Lru
Least Recently Used - evicts the entry that was accessed longest ago.
Best for general-purpose caching where recent items are more likely to be accessed again.
Lfu
Least Frequently Used - evicts the entry with the lowest access count.
Best for long-lived caches where consistently popular items should be retained regardless of recency.
Fifo
First In, First Out - evicts the oldest entry regardless of access pattern.
Best for time-based caching where age matters more than access patterns.
Trait Implementations§
Source§impl Clone for EvictionPolicy
impl Clone for EvictionPolicy
Source§fn clone(&self) -> EvictionPolicy
fn clone(&self) -> EvictionPolicy
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 moreSource§impl Debug for EvictionPolicy
impl Debug for EvictionPolicy
Source§impl Default for EvictionPolicy
impl Default for EvictionPolicy
Source§fn default() -> EvictionPolicy
fn default() -> EvictionPolicy
Returns the “default value” for a type. Read more
Source§impl PartialEq for EvictionPolicy
impl PartialEq for EvictionPolicy
impl Copy for EvictionPolicy
impl Eq for EvictionPolicy
impl StructuralPartialEq for EvictionPolicy
Auto Trait Implementations§
impl Freeze for EvictionPolicy
impl RefUnwindSafe for EvictionPolicy
impl Send for EvictionPolicy
impl Sync for EvictionPolicy
impl Unpin for EvictionPolicy
impl UnsafeUnpin for EvictionPolicy
impl UnwindSafe for EvictionPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.