pub struct L1Entry {
pub result: CachedResult,
pub query: String,
pub access_count: AtomicU64,
pub last_access: Instant,
}Expand description
Entry in the L1 hot cache
access_count is an AtomicU64 so cache hits can bump it under a
read lock on the containing map — touch() takes &self, not
&mut self. last_access is deliberately cosmetic (not consulted
by LRU eviction, which uses a separate ordered queue) and is not
updated per-access.
Fields§
§result: CachedResultThe cached result
query: StringOriginal query string (for exact match)
access_count: AtomicU64Access count (atomic so hits only need a read lock on the map)
last_access: InstantCreation / last-put time. Not updated on hits (LRU uses a separate ordered queue), so this reflects when the entry was first stored.
Implementations§
Source§impl L1Entry
impl L1Entry
Sourcepub fn new(query: String, result: CachedResult) -> Self
pub fn new(query: String, result: CachedResult) -> Self
Create a new L1 cache entry
Sourcepub fn access_count(&self) -> u64
pub fn access_count(&self) -> u64
Get the current access count.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if this entry has expired
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for L1Entry
impl RefUnwindSafe for L1Entry
impl Send for L1Entry
impl Sync for L1Entry
impl Unpin for L1Entry
impl UnsafeUnpin for L1Entry
impl UnwindSafe for L1Entry
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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