pub struct CacheStats {
pub message_count: usize,
pub chat_count: usize,
pub total_memory_bytes: usize,
pub last_insert_duration: Duration,
pub avg_insert_duration_ns: u64,
pub insert_count: u64,
/* private fields */
}Expand description
Statistics for message cache operations
Fields§
§message_count: usizeTotal number of messages across all chats
chat_count: usizeTotal number of chats
total_memory_bytes: usizeEstimated total memory in bytes
last_insert_duration: DurationDuration of last insert operation
avg_insert_duration_ns: u64Average insert duration in nanoseconds
insert_count: u64Number of insert operations recorded
Implementations§
Source§impl CacheStats
impl CacheStats
pub fn new() -> Self
Sourcepub fn record_insert(&mut self, duration: Duration)
pub fn record_insert(&mut self, duration: Duration)
Record an insert operation’s duration
Sourcepub fn update_from_chats(&mut self, chats: &[Chat])
pub fn update_from_chats(&mut self, chats: &[Chat])
Update memory stats from current state
Sourcepub fn should_log(&self, interval: u64) -> bool
pub fn should_log(&self, interval: u64) -> bool
Check if we should log (every N inserts)
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 (const: unstable) · 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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