pub struct CacheMetadata {
pub created_at: u64,
pub last_accessed: u64,
pub ttl_ms: u64,
pub stale_ms: u64,
pub access_count: u64,
pub size_bytes: usize,
pub tags: Vec<String>,
}Expand description
Cache entry metadata
Fields§
§created_at: u64When the entry was created
last_accessed: u64When the entry was last accessed
ttl_ms: u64Time to live in milliseconds
stale_ms: u64Stale time in milliseconds (for stale-while-revalidate)
access_count: u64Number of times this entry was accessed
size_bytes: usizeSize of the cached data in bytes
Tags for invalidation
Implementations§
Source§impl CacheMetadata
impl CacheMetadata
Sourcepub fn state(&self, now: u64) -> CacheState
pub fn state(&self, now: u64) -> CacheState
Check current state based on timestamp
Sourcepub fn is_expired(&self, now: u64) -> bool
pub fn is_expired(&self, now: u64) -> bool
Check if entry is expired
Trait Implementations§
Source§impl Clone for CacheMetadata
impl Clone for CacheMetadata
Source§fn clone(&self) -> CacheMetadata
fn clone(&self) -> CacheMetadata
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 CacheMetadata
impl RefUnwindSafe for CacheMetadata
impl Send for CacheMetadata
impl Sync for CacheMetadata
impl Unpin for CacheMetadata
impl UnwindSafe for CacheMetadata
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