tiered_cache/
stats.rs

1use serde::Serialize;
2
3/// Statistics for the entire cache system
4#[derive(Clone, Debug, Serialize)]
5pub struct CacheStats {
6    /// Statistics for each individual tier
7    pub tier_stats: Vec<TierStats>,
8    /// Total number of items across all tiers
9    pub total_items: usize,
10    /// Total size in bytes across all tiers
11    pub total_size: usize,
12}
13
14/// Statistics for a single cache tier
15#[derive(Clone, Debug, Serialize)]
16pub struct TierStats {
17    /// Number of items currently in the tier
18    pub items: usize,
19    /// Current total size in bytes
20    pub size: usize,
21    /// Maximum capacity in bytes
22    pub capacity: usize,
23    /// Number of cache hits
24    pub hit_count: u64,
25    /// Number of cache misses
26    pub miss_count: u64,
27}