pub struct CacheStats { /* private fields */ }Expand description
Aggregated cache statistics: hits, reads, and token savings.
Counters are atomic so they can be updated on the read-locked cache-hit fast path without taking a write lock.
Implementations§
Source§impl CacheStats
impl CacheStats
Sourcepub fn total_reads(&self) -> u64
pub fn total_reads(&self) -> u64
Total number of read operations recorded.
Sourcepub fn cache_hits(&self) -> u64
pub fn cache_hits(&self) -> u64
Total number of cache hits recorded.
Sourcepub fn total_original_tokens(&self) -> u64
pub fn total_original_tokens(&self) -> u64
Sum of original (uncompressed) token counts across all reads.
Sourcepub fn total_sent_tokens(&self) -> u64
pub fn total_sent_tokens(&self) -> u64
Sum of tokens actually sent to the model.
Sourcepub fn files_tracked(&self) -> u64
pub fn files_tracked(&self) -> u64
Number of distinct files currently tracked.
Sourcepub fn tokens_saved(&self) -> u64
pub fn tokens_saved(&self) -> u64
Returns the total number of tokens saved by cache hits.
Sourcepub fn savings_percent(&self) -> f64
pub fn savings_percent(&self) -> f64
Returns the savings as a percentage of total original tokens.
Trait Implementations§
Source§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 UnsafeUnpin 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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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