Trait memflow::types::cache::CacheValidator
source · pub trait CacheValidatorwhere
Self: Send,{
// Required methods
fn allocate_slots(&mut self, slot_count: usize);
fn is_slot_valid(&self, slot_id: usize) -> bool;
fn validate_slot(&mut self, slot_id: usize);
fn invalidate_slot(&mut self, slot_id: usize);
// Provided method
fn update_validity(&mut self) { ... }
}
Expand description
Validators are used when working with caches and determine for how long a specific cache entry stays valid.
Required Methods§
sourcefn allocate_slots(&mut self, slot_count: usize)
fn allocate_slots(&mut self, slot_count: usize)
Allocate the required amount of slots used for validation
sourcefn is_slot_valid(&self, slot_id: usize) -> bool
fn is_slot_valid(&self, slot_id: usize) -> bool
Checks wether or not the given slot is valid.
sourcefn validate_slot(&mut self, slot_id: usize)
fn validate_slot(&mut self, slot_id: usize)
Callback from the cache implementation when a page is cached and the slot should become valid.
sourcefn invalidate_slot(&mut self, slot_id: usize)
fn invalidate_slot(&mut self, slot_id: usize)
Callback from the caching implementation to mark a slot as invalid.
This can happen if two different cache entries fall into the same slot id.
Provided Methods§
sourcefn update_validity(&mut self)
fn update_validity(&mut self)
Invoked once per Read/Write so internal state can be updated if necessary.
This is an optimization so things like std::time::Instant
only need to be computed once.