pub enum EvictionPolicy {
NoEviction,
AllKeysLru,
AllKeysLfu,
AllKeysRandom,
VolatileLru,
VolatileLfu,
VolatileRandom,
VolatileTtl,
}Expand description
Maxmemory eviction policy. Mirror of kevy_config::EvictionPolicy —
duplicated here so kevy-store stays a leaf crate (no kevy-config dep).
Variants§
NoEviction
Refuse writes once maxmemory is hit. Default.
AllKeysLru
Approximated LRU across all keys.
AllKeysLfu
Approximated LFU across all keys.
AllKeysRandom
Random key across all keys.
VolatileLru
Approximated LRU across keys with a TTL.
VolatileLfu
Approximated LFU across keys with a TTL.
VolatileRandom
Random key from those with a TTL.
VolatileTtl
Key with the shortest remaining TTL.
Implementations§
Source§impl EvictionPolicy
impl EvictionPolicy
Sourcepub fn uses_lru(self) -> bool
pub fn uses_lru(self) -> bool
Whether the policy ranks candidates by LRU clock (read-touches matter).
Sourcepub fn uses_lfu(self) -> bool
pub fn uses_lfu(self) -> bool
Whether the policy ranks candidates by LFU counter (read-touches and log-counter increments matter).
Sourcepub fn is_volatile(self) -> bool
pub fn is_volatile(self) -> bool
Whether the policy restricts eviction to keys that carry a TTL.
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for EvictionPolicy
Source§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
impl Eq for EvictionPolicy
Source§impl PartialEq for EvictionPolicy
impl PartialEq for EvictionPolicy
Source§fn eq(&self, other: &EvictionPolicy) -> bool
fn eq(&self, other: &EvictionPolicy) -> bool
Tests for
self and other values to be equal, and is used by ==.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