pub struct CacheMetrics { /* private fields */ }Expand description
Cache metrics collector
Implementations§
Source§impl CacheMetrics
impl CacheMetrics
Sourcepub fn record_hit(&self, level: CacheLevel, latency: Duration)
pub fn record_hit(&self, level: CacheLevel, latency: Duration)
Record a cache hit
Sourcepub fn record_miss(&self, _latency: Duration)
pub fn record_miss(&self, _latency: Duration)
Record a cache miss
Sourcepub fn record_skip(&self)
pub fn record_skip(&self)
Record a cache skip (due to hint)
Sourcepub fn record_put(&self)
pub fn record_put(&self)
Record a cache put
Sourcepub fn record_invalidation(&self, table_count: usize)
pub fn record_invalidation(&self, table_count: usize)
Record cache invalidation
Sourcepub fn record_clear(&self)
pub fn record_clear(&self)
Record cache clear
Sourcepub fn record_size_exceeded(&self)
pub fn record_size_exceeded(&self)
Record size exceeded rejection
Sourcepub fn record_eviction(&self, level: CacheLevel)
pub fn record_eviction(&self, level: CacheLevel)
Record eviction for a cache level
Sourcepub fn set_entry_count(&self, level: CacheLevel, count: u64)
pub fn set_entry_count(&self, level: CacheLevel, count: u64)
Update entry count for a cache level
Sourcepub fn set_memory_bytes(&self, level: CacheLevel, bytes: u64)
pub fn set_memory_bytes(&self, level: CacheLevel, bytes: u64)
Update memory usage for a cache level
Sourcepub fn snapshot(&self) -> CacheStatsSnapshot
pub fn snapshot(&self) -> CacheStatsSnapshot
Get a snapshot of current metrics
Sourcepub fn total_hits(&self) -> u64
pub fn total_hits(&self) -> u64
Get total hit count
Sourcepub fn total_misses(&self) -> u64
pub fn total_misses(&self) -> u64
Get total miss count
Trait Implementations§
Source§impl Debug for CacheMetrics
impl Debug for CacheMetrics
Auto Trait Implementations§
impl !Freeze for CacheMetrics
impl RefUnwindSafe for CacheMetrics
impl Send for CacheMetrics
impl Sync for CacheMetrics
impl Unpin for CacheMetrics
impl UnsafeUnpin for CacheMetrics
impl UnwindSafe for CacheMetrics
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more