Skip to main content

CacheEvictionPolicy

Trait CacheEvictionPolicy 

Source
pub trait CacheEvictionPolicy: Send + Sync {
    // Required methods
    fn select_eviction_candidates(
        &self,
        required_memory: usize,
        active_caches: &[(RequestId, Arc<dyn KvCacheHandle>)],
    ) -> Vec<RequestId>;
    fn record_access(&mut self, request_id: RequestId, access_time: Instant);
    fn name(&self) -> &str;
}
Expand description

Cache eviction strategies

Required Methods§

Source

fn select_eviction_candidates( &self, required_memory: usize, active_caches: &[(RequestId, Arc<dyn KvCacheHandle>)], ) -> Vec<RequestId>

Select caches to evict to free requested memory

Source

fn record_access(&mut self, request_id: RequestId, access_time: Instant)

Update cache access information

Source

fn name(&self) -> &str

Get policy name

Implementors§