pub struct PlannerStats { /* private fields */ }Expand description
The store’s planner-statistics cache.
Implementations§
Source§impl PlannerStats
impl PlannerStats
Sourcepub fn new(
resources: &StorageResources,
parent: Option<&ByteBudget>,
clock: Clock,
) -> Result<Self, StorageError>
pub fn new( resources: &StorageResources, parent: Option<&ByteBudget>, clock: Clock, ) -> Result<Self, StorageError>
Build from the store’s resources. parent is the logical cache
budget; without one the cache gets its own budget.
§Errors
Returns StorageError::InvalidConfiguration if the budget cannot be
created.
Sourcepub fn get(&self, key: &PlannerStatsKey, ci: u64) -> Option<PlannerStatsEntry>
pub fn get(&self, key: &PlannerStatsKey, ci: u64) -> Option<PlannerStatsEntry>
The cached entry for key, unless missing or older than
max_age_commits relative to ci. A hit refreshes the idle clock.
Sourcepub fn insert(&self, key: PlannerStatsKey, entry: PlannerStatsEntry) -> bool
pub fn insert(&self, key: PlannerStatsKey, entry: PlannerStatsEntry) -> bool
Cache entry for key, evicting least-recently-used entries if the
budget needs room. Returns whether it is resident.
Sourcepub fn evict_idle(&self) -> usize
pub fn evict_idle(&self) -> usize
Drop every entry unused for longer than the idle TTL. Returns how many were dropped.
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Occupancy and counters (zero when caching is disabled).
Auto Trait Implementations§
impl !Freeze for PlannerStats
impl !RefUnwindSafe for PlannerStats
impl !UnwindSafe for PlannerStats
impl Send for PlannerStats
impl Sync for PlannerStats
impl Unpin for PlannerStats
impl UnsafeUnpin for PlannerStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more