Skip to main content

CachePolicy

Trait CachePolicy 

Source
pub trait CachePolicy:
    Debug
    + Send
    + Sync {
    // Required method
    fn find_memory_victim(&self, cnt: usize) -> Vec<EntryID>;

    // Provided methods
    fn find_disk_victim(&self, _cnt: usize) -> Vec<EntryID> { ... }
    fn notify_insert(&self, _entry_id: &EntryID, _batch_type: CachedBatchType) { ... }
    fn notify_access(&self, _entry_id: &EntryID, _batch_type: CachedBatchType) { ... }
    fn notify_remove(&self, _entry_id: &EntryID) { ... }
}
Expand description

The cache policy that guides the replacement of LiquidCache

Required Methods§

Source

fn find_memory_victim(&self, cnt: usize) -> Vec<EntryID>

Give cnt amount of entries to evict when cache is full.

Provided Methods§

Source

fn find_disk_victim(&self, _cnt: usize) -> Vec<EntryID>

Give cnt amount of disk entries to remove when disk is full.

Source

fn notify_insert(&self, _entry_id: &EntryID, _batch_type: CachedBatchType)

Notify the cache policy that an entry was inserted.

Source

fn notify_access(&self, _entry_id: &EntryID, _batch_type: CachedBatchType)

Notify the cache policy that an entry was accessed.

Source

fn notify_remove(&self, _entry_id: &EntryID)

Notify the cache policy that an entry was removed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§