pub struct AccessStats {
pub access_count: u64,
pub last_access: Instant,
pub first_access: Instant,
pub access_times: VecDeque<Instant>,
pub current_tier: usize,
pub size_bytes: usize,
}Expand description
Access statistics for a cache item
Fields§
§access_count: u64Total number of accesses
last_access: InstantLast access time
first_access: InstantFirst access time
access_times: VecDeque<Instant>Access timestamps (for frequency analysis)
current_tier: usizeCurrent tier level
size_bytes: usizeItem size in bytes
Implementations§
Source§impl AccessStats
impl AccessStats
Sourcepub fn record_access(&mut self)
pub fn record_access(&mut self)
Record an access
Sourcepub fn recency_score(&self, max_age: Duration) -> f64
pub fn recency_score(&self, max_age: Duration) -> f64
Calculate recency score (0.0 = old, 1.0 = very recent)
Sourcepub fn heat_score(&self, max_age: Duration) -> f64
pub fn heat_score(&self, max_age: Duration) -> f64
Calculate heat score (combination of frequency and recency)
Trait Implementations§
Source§impl Clone for AccessStats
impl Clone for AccessStats
Source§fn clone(&self) -> AccessStats
fn clone(&self) -> AccessStats
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 moreAuto Trait Implementations§
impl Freeze for AccessStats
impl RefUnwindSafe for AccessStats
impl Send for AccessStats
impl Sync for AccessStats
impl Unpin for AccessStats
impl UnsafeUnpin for AccessStats
impl UnwindSafe for AccessStats
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> 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