pub struct CacheEntry<T> {
pub value: T,
pub created_at: Instant,
pub ttl: Option<Duration>,
pub tags: Vec<EntityTag>,
pub size_bytes: Option<usize>,
}Expand description
A cached entry with metadata.
Fields§
§value: TThe cached value.
created_at: InstantWhen the entry was created.
ttl: Option<Duration>Time-to-live for this entry.
Tags associated with this entry.
size_bytes: Option<usize>Size in bytes (if known).
Implementations§
Source§impl<T> CacheEntry<T>
impl<T> CacheEntry<T>
Set tags.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if the entry is expired.
Sourcepub fn remaining_ttl(&self) -> Option<Duration>
pub fn remaining_ttl(&self) -> Option<Duration>
Get remaining TTL.
Trait Implementations§
Source§impl<T: Clone> Clone for CacheEntry<T>
impl<T: Clone> Clone for CacheEntry<T>
Source§fn clone(&self) -> CacheEntry<T>
fn clone(&self) -> CacheEntry<T>
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<T> Freeze for CacheEntry<T>where
T: Freeze,
impl<T> RefUnwindSafe for CacheEntry<T>where
T: RefUnwindSafe,
impl<T> Send for CacheEntry<T>where
T: Send,
impl<T> Sync for CacheEntry<T>where
T: Sync,
impl<T> Unpin for CacheEntry<T>where
T: Unpin,
impl<T> UnwindSafe for CacheEntry<T>where
T: UnwindSafe,
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