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§
Sourcefn should_promote(&self, key: u64, stats: &AccessStats) -> bool
fn should_promote(&self, key: u64, stats: &AccessStats) -> bool
Return true if the entry should be promoted to a faster tier.
Sourcefn eviction_candidate(
&self,
tier: usize,
entries: &FxHashMap<u64, CacheEntry>,
tracker: &AccessTracker,
) -> Option<u64>
fn eviction_candidate( &self, tier: usize, entries: &FxHashMap<u64, CacheEntry>, tracker: &AccessTracker, ) -> Option<u64>
Select a candidate for eviction from the given tier.