pub struct QueryCacheStats {
pub total_queries: AtomicU64,
pub cache_hits: AtomicU64,
pub cache_misses: AtomicU64,
pub expired_removed: AtomicU64,
pub evicted_entries: AtomicU64,
pub current_cache_size: AtomicUsize,
pub estimated_memory_bytes: AtomicUsize,
pub hit_rate: f32,
pub avg_time_saved_ms: f32,
/* private fields */
}Expand description
Cache statistics using atomic operations
Fields§
§total_queries: AtomicU64Total number of queries processed (atomic)
cache_hits: AtomicU64Number of cache hits (atomic)
cache_misses: AtomicU64Number of cache misses (atomic)
expired_removed: AtomicU64Number of expired entries removed (atomic)
evicted_entries: AtomicU64Number of entries evicted due to size limit (atomic)
current_cache_size: AtomicUsizeCurrent cache size (atomic)
estimated_memory_bytes: AtomicUsizeMemory usage estimation in bytes (atomic)
hit_rate: f32Hit rate percentage (computed)
avg_time_saved_ms: f32Average query processing time saved (ms)
Implementations§
Source§impl QueryCacheStats
impl QueryCacheStats
Sourcepub fn record_hit(&self, similarity: f32)
pub fn record_hit(&self, similarity: f32)
Record a cache hit (via CAS)
Sourcepub fn record_miss(&self)
pub fn record_miss(&self)
Record a cache miss
Sourcepub fn avg_hit_similarity(&self) -> f32
pub fn avg_hit_similarity(&self) -> f32
Get average hit similarity
Sourcepub fn snapshot(&self) -> QueryCacheStatsSnapshot
pub fn snapshot(&self) -> QueryCacheStatsSnapshot
Get snapshot of current stats
Trait Implementations§
Source§impl Debug for QueryCacheStats
impl Debug for QueryCacheStats
Source§impl Default for QueryCacheStats
impl Default for QueryCacheStats
Source§impl<'de> Deserialize<'de> for QueryCacheStats
impl<'de> Deserialize<'de> for QueryCacheStats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl !Freeze for QueryCacheStats
impl RefUnwindSafe for QueryCacheStats
impl Send for QueryCacheStats
impl Sync for QueryCacheStats
impl Unpin for QueryCacheStats
impl UnsafeUnpin for QueryCacheStats
impl UnwindSafe for QueryCacheStats
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request