pub struct CacheStats {Show 15 fields
pub l1_hits: u64,
pub l1_misses: u64,
pub l2_hits: u64,
pub l2_misses: u64,
pub l1_sets: u64,
pub l2_sets: u64,
pub l1_deletes: u64,
pub l2_deletes: u64,
pub total_operations: u64,
pub l1_item_count: u64,
pub l1_capacity_used: u64,
pub prefetch_count: u64,
pub compression_count: u64,
pub compression_bytes_saved: u64,
pub timestamp: DateTime<Utc>,
}Expand description
缓存统计快照
包含缓存系统的详细统计信息,用于监控和报告。
Fields§
§l1_hits: u64L1 命中次数
l1_misses: u64L1 未命中次数
l2_hits: u64L2 命中次数
l2_misses: u64L2 未命中次数
l1_sets: u64L1 设置次数
l2_sets: u64L2 设置次数
l1_deletes: u64L1 删除次数
l2_deletes: u64L2 删除次数
total_operations: u64总操作次数
l1_item_count: u64L1 缓存项数量
l1_capacity_used: u64L1 容量使用(字节)
prefetch_count: u64预取操作次数
compression_count: u64压缩操作次数
compression_bytes_saved: u64压缩节省的字节数
timestamp: DateTime<Utc>快照创建时间戳
Implementations§
Source§impl CacheStats
impl CacheStats
Sourcepub fn l1_hit_rate(&self) -> f64
pub fn l1_hit_rate(&self) -> f64
计算 L1 命中率
Sourcepub fn l2_hit_rate(&self) -> f64
pub fn l2_hit_rate(&self) -> f64
计算 L2 命中率
Sourcepub fn overall_hit_rate(&self) -> f64
pub fn overall_hit_rate(&self) -> f64
计算总体命中率
Sourcepub fn l1_hit_rate_percent(&self) -> String
pub fn l1_hit_rate_percent(&self) -> String
获取命中率百分比字符串
Sourcepub fn l2_hit_rate_percent(&self) -> String
pub fn l2_hit_rate_percent(&self) -> String
获取 L2 命中率百分比字符串
Sourcepub fn overall_hit_rate_percent(&self) -> String
pub fn overall_hit_rate_percent(&self) -> String
获取总体命中率百分比字符串
Sourcepub fn export_prometheus(&self) -> String
pub fn export_prometheus(&self) -> String
导出为 Prometheus 格式
Sourcepub fn export_json(&self) -> Result<String, Error>
pub fn export_json(&self) -> Result<String, Error>
导出为 JSON 格式
Trait Implementations§
Source§impl Clone for CacheStats
impl Clone for CacheStats
Source§fn clone(&self) -> CacheStats
fn clone(&self) -> CacheStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CacheStats
impl Debug for CacheStats
Source§impl Default for CacheStats
impl Default for CacheStats
Source§fn default() -> CacheStats
fn default() -> CacheStats
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CacheStats
impl RefUnwindSafe for CacheStats
impl Send for CacheStats
impl Sync for CacheStats
impl Unpin for CacheStats
impl UnwindSafe for CacheStats
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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