pub struct CacheLevelStats {
pub hits: u64,
pub misses: u64,
pub entries: usize,
pub capacity: usize,
pub usage_bytes: u64,
pub max_usage_bytes: u64,
pub evictions: u64,
pub hit_rate: f64,
pub load_factor: f64,
pub avg_entry_size: f64,
}Expand description
Statistics for a single cache level (L1, L2, etc.)
Fields§
§hits: u64Total cache hits
misses: u64Total cache misses
entries: usizeCurrent number of entries
capacity: usizeMaximum capacity
usage_bytes: u64Estimated memory/disk usage in bytes
max_usage_bytes: u64Maximum allowed usage in bytes
evictions: u64Cache evictions
hit_rate: f64Hit rate (0.0 to 1.0)
load_factor: f64Load factor (entries / capacity)
avg_entry_size: f64Average entry size in bytes
Implementations§
Source§impl CacheLevelStats
impl CacheLevelStats
Sourcepub fn update_hit_rate(&mut self)
pub fn update_hit_rate(&mut self)
Update hit rate based on current hits and misses
Sourcepub fn update_load_factor(&mut self)
pub fn update_load_factor(&mut self)
Update load factor based on current entries and capacity
Sourcepub fn update_avg_entry_size(&mut self)
pub fn update_avg_entry_size(&mut self)
Update average entry size
Sourcepub fn update_calculated_fields(&mut self)
pub fn update_calculated_fields(&mut self)
Update all calculated fields
Trait Implementations§
Source§impl Clone for CacheLevelStats
impl Clone for CacheLevelStats
Source§fn clone(&self) -> CacheLevelStats
fn clone(&self) -> CacheLevelStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CacheLevelStats
impl Debug for CacheLevelStats
Source§impl Default for CacheLevelStats
impl Default for CacheLevelStats
Source§impl<'de> Deserialize<'de> for CacheLevelStats
impl<'de> Deserialize<'de> for CacheLevelStats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CacheLevelStats
impl RefUnwindSafe for CacheLevelStats
impl Send for CacheLevelStats
impl Sync for CacheLevelStats
impl Unpin for CacheLevelStats
impl UnsafeUnpin for CacheLevelStats
impl UnwindSafe for CacheLevelStats
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