pub struct CacheEntry<T> {
pub data: T,
pub created_at: DateTime<Utc>,
pub expires_at: Option<DateTime<Utc>>,
pub access_count: u64,
pub last_accessed: Option<DateTime<Utc>>,
}Expand description
Cache entry metadata
Fields§
§data: TCached data
created_at: DateTime<Utc>Creation timestamp
expires_at: Option<DateTime<Utc>>Expiration timestamp (None for no expiration)
access_count: u64Number of times this entry was accessed
last_accessed: Option<DateTime<Utc>>Last access timestamp
Implementations§
Source§impl<T> CacheEntry<T>
impl<T> CacheEntry<T>
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if entry is expired
Sourcepub fn mark_accessed(&mut self)
pub fn mark_accessed(&mut self)
Mark entry as accessed
Trait Implementations§
Source§impl<T: Clone> Clone for CacheEntry<T>
impl<T: Clone> Clone for CacheEntry<T>
Source§impl<T: Debug> Debug for CacheEntry<T>
impl<T: Debug> Debug for CacheEntry<T>
Source§impl<'de, T> Deserialize<'de> for CacheEntry<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for CacheEntry<T>where
T: Deserialize<'de>,
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<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> UnsafeUnpin for CacheEntry<T>where
T: UnsafeUnpin,
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