pub struct GlobalStats {
pub total_requests: AtomicU64,
pub hits: AtomicU64,
pub misses: AtomicU64,
pub stale_hits: AtomicU64,
pub stores: AtomicU64,
pub invalidations: AtomicU64,
pub uptime_start: SystemTime,
/* private fields */
}Expand description
Global statistics collector.
Fields§
§total_requests: AtomicU64Total number of cache requests
hits: AtomicU64Total cache hits
misses: AtomicU64Total cache misses
stale_hits: AtomicU64Total stale hits served
stores: AtomicU64Total entries stored
invalidations: AtomicU64Total invalidations
uptime_start: SystemTimeUptime start
Implementations§
Source§impl GlobalStats
impl GlobalStats
Sourcepub fn record_hit(&self, key: &str)
pub fn record_hit(&self, key: &str)
Records a cache hit.
Sourcepub fn record_miss(&self, _key: &str)
pub fn record_miss(&self, _key: &str)
Records a cache miss.
Sourcepub fn record_stale_hit(&self, key: &str)
pub fn record_stale_hit(&self, key: &str)
Records a stale hit.
Sourcepub fn record_store(&self, _key: &str)
pub fn record_store(&self, _key: &str)
Records a cache store operation.
Sourcepub fn record_invalidation(&self)
pub fn record_invalidation(&self)
Records an invalidation.
Sourcepub fn hot_keys(&self, limit: usize) -> Vec<HotKeyInfo>
pub fn hot_keys(&self, limit: usize) -> Vec<HotKeyInfo>
Returns the top N most frequently accessed keys.
Sourcepub fn snapshot(&self) -> StatsSnapshot
pub fn snapshot(&self) -> StatsSnapshot
Returns the current statistics as a serializable struct.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GlobalStats
impl !RefUnwindSafe for GlobalStats
impl Send for GlobalStats
impl Sync for GlobalStats
impl Unpin for GlobalStats
impl !UnwindSafe for GlobalStats
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