pub struct CacheStats {
pub total_entries: u64,
pub expired_entries: u64,
pub memory_usage: Option<u64>,
pub hit_rate: f64,
pub hits: u64,
pub misses: u64,
pub sets: u64,
pub deletes: u64,
}Expand description
Cache statistics
Fields§
§total_entries: u64Total number of entries in cache
expired_entries: u64Number of entries currently expired but not yet cleaned up
memory_usage: Option<u64>Total cache size in bytes (if available)
hit_rate: f64Hit rate (0.0 to 1.0)
hits: u64Number of successful get operations
misses: u64Number of failed get operations (misses)
sets: u64Number of set operations
deletes: u64Number of delete operations
Implementations§
Source§impl CacheStats
impl CacheStats
Sourcepub fn update_hit_rate(&mut self)
pub fn update_hit_rate(&mut self)
Update hit rate based on hits and misses
Sourcepub fn record_hit(&mut self)
pub fn record_hit(&mut self)
Record a cache hit
Sourcepub fn record_miss(&mut self)
pub fn record_miss(&mut self)
Record a cache miss
Sourcepub fn record_set(&mut self)
pub fn record_set(&mut self)
Record a cache set
Sourcepub fn record_delete(&mut self)
pub fn record_delete(&mut self)
Record a cache delete
Trait Implementations§
Source§impl Clone for CacheStats
impl Clone for CacheStats
Source§impl Debug for CacheStats
impl Debug for CacheStats
Auto Trait Implementations§
impl Freeze for CacheStats
impl RefUnwindSafe for CacheStats
impl Send for CacheStats
impl Sync for CacheStats
impl Unpin for CacheStats
impl UnsafeUnpin for CacheStats
impl UnwindSafe for CacheStats
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