Expand description
Cache admission policies for intelligent caching decisions.
This module implements various cache admission policies that determine whether new items should be admitted to the cache based on their predicted value. This helps prevent cache pollution from items that are unlikely to be accessed again.
§Implemented Policies
- TinyLFU: Tiny Least Frequently Used with Count-Min Sketch
- SLRU: Segmented LRU with probationary and protected segments
§Example
use chie_core::cache_admission::{TinyLFU, AdmissionPolicy};
let mut policy = TinyLFU::new(1000, 4);
// Record accesses
policy.record_access("item1");
policy.record_access("item1");
policy.record_access("item2");
// Check if item should be admitted (comparing with victim)
if policy.should_admit("new_item", "victim_item") {
println!("Admit new_item to cache");
} else {
println!("Keep victim_item in cache");
}Structs§
Enums§
- Segment
- Cache segment in SLRU.
Traits§
- Admission
Policy - Admission policy trait.