pub struct L1HotCache { /* private fields */ }Expand description
L1 hot cache (per-connection)
This cache stores exact query matches for a single connection. It uses LRU eviction when the cache is full.
Implementations§
Source§impl L1HotCache
impl L1HotCache
Sourcepub fn get(&self, query: &str) -> Option<CachedResult>
pub fn get(&self, query: &str) -> Option<CachedResult>
Look up a query in the cache.
Hits take only a read lock on the entries map; the touch() call
uses atomic fetch_add on access_count rather than exclusive
access. Expired entries still need a write-lock to evict, but that
is only the slow path.
Sourcepub fn put(&self, query: String, result: CachedResult)
pub fn put(&self, query: String, result: CachedResult)
Store a query result in the cache
Sourcepub fn stats(&self) -> L1CacheStats
pub fn stats(&self) -> L1CacheStats
Get hit statistics
Sourcepub fn evict_expired(&self)
pub fn evict_expired(&self)
Evict expired entries
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for L1HotCache
impl !RefUnwindSafe for L1HotCache
impl Send for L1HotCache
impl Sync for L1HotCache
impl Unpin for L1HotCache
impl UnsafeUnpin for L1HotCache
impl UnwindSafe for L1HotCache
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