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§
Sourcefn find_memory_victim(&self, cnt: usize) -> Vec<EntryID>
fn find_memory_victim(&self, cnt: usize) -> Vec<EntryID>
Give cnt amount of entries to evict when cache is full.
Provided Methods§
Sourcefn find_disk_victim(&self, _cnt: usize) -> Vec<EntryID>
fn find_disk_victim(&self, _cnt: usize) -> Vec<EntryID>
Give cnt amount of disk entries to remove when disk is full.
Sourcefn notify_insert(&self, _entry_id: &EntryID, _batch_type: CachedBatchType)
fn notify_insert(&self, _entry_id: &EntryID, _batch_type: CachedBatchType)
Notify the cache policy that an entry was inserted.
Sourcefn notify_access(&self, _entry_id: &EntryID, _batch_type: CachedBatchType)
fn notify_access(&self, _entry_id: &EntryID, _batch_type: CachedBatchType)
Notify the cache policy that an entry was accessed.
Sourcefn notify_remove(&self, _entry_id: &EntryID)
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".