Skip to main content

TierPolicy

Trait TierPolicy 

Source
pub trait TierPolicy: Send + Sync {
    // Required methods
    fn should_promote(&self, key: u64, stats: &AccessStats) -> bool;
    fn eviction_candidate(
        &self,
        tier: usize,
        entries: &FxHashMap<u64, CacheEntry>,
        tracker: &AccessTracker,
    ) -> Option<u64>;
}
Expand description

Policy that decides promotion and eviction behavior.

Required Methods§

Source

fn should_promote(&self, key: u64, stats: &AccessStats) -> bool

Return true if the entry should be promoted to a faster tier.

Source

fn eviction_candidate( &self, tier: usize, entries: &FxHashMap<u64, CacheEntry>, tracker: &AccessTracker, ) -> Option<u64>

Select a candidate for eviction from the given tier.

Implementors§