pub struct LruCacheMetrics {
pub core: CoreCacheMetrics,
}
Expand description
LRU-specific metrics (extends CoreCacheMetrics)
This struct contains metrics specific to the LRU (Least Recently Used) cache algorithm. Currently, LRU uses only the core metrics, but this structure allows for future LRU-specific metrics to be added.
Fields§
§core: CoreCacheMetrics
Core metrics common to all cache algorithms
Implementations§
Source§impl LruCacheMetrics
impl LruCacheMetrics
Sourcepub fn new(max_cache_size_bytes: u64) -> Self
pub fn new(max_cache_size_bytes: u64) -> Self
Creates a new LruCacheMetrics instance with the specified maximum cache size
§Arguments
max_cache_size_bytes
- The maximum allowed cache size in bytes
Sourcepub fn to_btreemap(&self) -> BTreeMap<String, f64>
pub fn to_btreemap(&self) -> BTreeMap<String, f64>
Converts LRU metrics to a BTreeMap for reporting
This method returns all metrics relevant to the LRU cache algorithm. Currently, this includes only core metrics, but LRU-specific metrics could be added here in the future.
Uses BTreeMap to ensure consistent, deterministic ordering of metrics.
§Returns
A BTreeMap containing all LRU cache metrics as key-value pairs
Trait Implementations§
Source§impl CacheMetrics for LruCacheMetrics
impl CacheMetrics for LruCacheMetrics
Source§fn metrics(&self) -> BTreeMap<String, f64>
fn metrics(&self) -> BTreeMap<String, f64>
Returns all LRU cache metrics as key-value pairs in deterministic order
§Returns
A BTreeMap containing all metrics tracked by this LRU cache instance
Source§fn algorithm_name(&self) -> &'static str
fn algorithm_name(&self) -> &'static str
Returns the algorithm name for this cache implementation
§Returns
“LRU” - identifying this as a Least Recently Used cache
Source§impl Clone for LruCacheMetrics
impl Clone for LruCacheMetrics
Source§fn clone(&self) -> LruCacheMetrics
fn clone(&self) -> LruCacheMetrics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more