pub struct CacheDiagnostics {
pub stats: CacheStats,
pub estimated_entries: u64,
}Expand description
User-facing diagnostic snapshot for a local cache instance.
CacheDiagnostics combines lightweight counters with runtime-level
observations such as the approximate number of entries currently known to
the local backend. The values are snapshots, not a durable metrics store.
§Example
use hydracache_core::{CacheDiagnostics, CacheStats};
let diagnostics = CacheDiagnostics {
stats: CacheStats {
hits: 1,
misses: 1,
..CacheStats::default()
},
estimated_entries: 1,
};
assert_eq!(diagnostics.total_requests(), 2);
assert_eq!(diagnostics.hit_ratio(), Some(0.5));
assert!(!diagnostics.is_empty());Fields§
§stats: CacheStatsLightweight cache counters.
estimated_entries: u64Approximate number of entries currently held by the local backend.
This value comes from the in-memory backend and is meant for debugging and smoke checks, not billing, quotas, or exact accounting.
Implementations§
Trait Implementations§
Source§impl Clone for CacheDiagnostics
impl Clone for CacheDiagnostics
Source§fn clone(&self) -> CacheDiagnostics
fn clone(&self) -> CacheDiagnostics
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for CacheDiagnostics
Source§impl Debug for CacheDiagnostics
impl Debug for CacheDiagnostics
Source§impl Default for CacheDiagnostics
impl Default for CacheDiagnostics
Source§fn default() -> CacheDiagnostics
fn default() -> CacheDiagnostics
Returns the “default value” for a type. Read more
Source§impl PartialEq for CacheDiagnostics
impl PartialEq for CacheDiagnostics
Source§fn eq(&self, other: &CacheDiagnostics) -> bool
fn eq(&self, other: &CacheDiagnostics) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CacheDiagnostics
Auto Trait Implementations§
impl Freeze for CacheDiagnostics
impl RefUnwindSafe for CacheDiagnostics
impl Send for CacheDiagnostics
impl Sync for CacheDiagnostics
impl Unpin for CacheDiagnostics
impl UnsafeUnpin for CacheDiagnostics
impl UnwindSafe for CacheDiagnostics
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