pub struct LruStrategy { /* private fields */ }Expand description
Configuration for the sharded LRU EvictionStrategy.
Use LruStrategy::default for the default shard count, or override it with
LruStrategy::with_shards. The shard count controls how the LRU state is partitioned;
see EvictionStrategy::Lru for how sharding affects eviction accuracy.
Implementations§
Source§impl LruStrategy
impl LruStrategy
Sourcepub fn with_shards(self, shards: u8) -> Self
pub fn with_shards(self, shards: u8) -> Self
Sets the number of shards, rounded to the nearest power of two (minimum 1). Rounding keeps hash-based key distribution well-balanced without rejecting arbitrary counts.
Trait Implementations§
Source§impl Clone for LruStrategy
impl Clone for LruStrategy
impl Copy for LruStrategy
Source§impl Debug for LruStrategy
impl Debug for LruStrategy
Source§impl Default for LruStrategy
impl Default for LruStrategy
impl Eq for LruStrategy
Source§impl PartialEq for LruStrategy
impl PartialEq for LruStrategy
impl StructuralPartialEq for LruStrategy
Auto Trait Implementations§
impl Freeze for LruStrategy
impl RefUnwindSafe for LruStrategy
impl Send for LruStrategy
impl Sync for LruStrategy
impl Unpin for LruStrategy
impl UnsafeUnpin for LruStrategy
impl UnwindSafe for LruStrategy
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§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.