#[non_exhaustive]pub struct CacheMetrics {
pub hits: u64,
pub misses: u64,
pub evictions: u64,
pub expired: u64,
pub insertions: u64,
pub collisions: u64,
pub pending_cached: u64,
pub pending_replayed: u64,
pub pending_dropped: u64,
pub pending_replay_failed: u64,
}Expand description
A point-in-time snapshot of cache metrics.
This provides a consistent view of metrics without requiring atomic operations for each field access.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.hits: u64Number of successful template lookups (cache hits)
misses: u64Number of failed template lookups (cache misses)
evictions: u64Number of templates evicted due to LRU policy
expired: u64Number of templates that expired due to TTL
insertions: u64Number of template insertions (including replacements)
collisions: u64Number of template ID collisions (same ID, different definition)
pending_cached: u64Number of flows cached as pending (awaiting template)
pending_replayed: u64Number of pending flows successfully replayed after template arrived
pending_dropped: u64Number of pending flows dropped (expired or evicted)
pending_replay_failed: u64Number of pending flows that failed to replay (parse error after template arrived)
Implementations§
Source§impl CacheMetrics
impl CacheMetrics
Sourcepub fn hit_rate(&self) -> Option<f64>
pub fn hit_rate(&self) -> Option<f64>
Calculate the cache hit rate (0.0 to 1.0)
Returns None if there have been no lookups yet.
Sourcepub fn miss_rate(&self) -> Option<f64>
pub fn miss_rate(&self) -> Option<f64>
Calculate the cache miss rate (0.0 to 1.0)
Returns None if there have been no lookups yet.
Sourcepub fn total_lookups(&self) -> u64
pub fn total_lookups(&self) -> u64
Total number of template lookups (hits + misses)
Trait Implementations§
Source§impl Clone for CacheMetrics
impl Clone for CacheMetrics
Source§fn clone(&self) -> CacheMetrics
fn clone(&self) -> CacheMetrics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CacheMetrics
impl Debug for CacheMetrics
Source§impl PartialEq for CacheMetrics
impl PartialEq for CacheMetrics
impl Copy for CacheMetrics
impl Eq for CacheMetrics
impl StructuralPartialEq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.