pub struct CacheEntry {
pub data: Vec<u8>,
pub created_at: Instant,
pub ttl: Duration,
pub access_count: AtomicU64,
pub last_access: AtomicU64,
}Expand description
Cache entry with TTL.
Fields§
§data: Vec<u8>Cached response data.
created_at: InstantCreation timestamp.
ttl: DurationTime-to-live.
access_count: AtomicU64Access count.
last_access: AtomicU64Last access timestamp.
Implementations§
Source§impl CacheEntry
impl CacheEntry
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Returns whether the entry is expired.
Sourcepub fn record_access(&self)
pub fn record_access(&self)
Records an access.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CacheEntry
impl RefUnwindSafe for CacheEntry
impl Send for CacheEntry
impl Sync for CacheEntry
impl Unpin for CacheEntry
impl UnsafeUnpin for CacheEntry
impl UnwindSafe for CacheEntry
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