use crate::key::CompactCacheKey;
use async_trait::async_trait;
use pingora_error::Result;
use std::time::SystemTime;
pub mod lru;
pub mod simple_lru;
#[async_trait]
pub trait EvictionManager: Send + Sync {
fn total_size(&self) -> usize;
fn total_items(&self) -> usize;
fn evicted_size(&self) -> usize;
fn evicted_items(&self) -> usize;
fn admit(
&self,
item: CompactCacheKey,
size: usize,
fresh_until: SystemTime,
) -> Vec<CompactCacheKey>;
fn increment_weight(
&self,
item: &CompactCacheKey,
delta: usize,
max_weight: Option<usize>,
) -> Vec<CompactCacheKey>;
fn remove(&self, item: &CompactCacheKey);
fn access(&self, item: &CompactCacheKey, size: usize, fresh_until: SystemTime) -> bool;
fn peek(&self, item: &CompactCacheKey) -> bool;
async fn save(&self, dir_path: &str) -> Result<()>;
async fn load(&self, dir_path: &str) -> Result<()>;
}