pub struct L2WarmCache { /* private fields */ }Expand description
L2 warm cache (shared across connections)
This cache stores normalized query results shared across all connections. It supports two storage backends:
- Memory: Fast, volatile storage
- Mmap: Memory-mapped file that survives restarts
Implementations§
Source§impl L2WarmCache
impl L2WarmCache
Sourcepub async fn get(&self, key: &CacheKey) -> Option<CachedResult>
pub async fn get(&self, key: &CacheKey) -> Option<CachedResult>
Look up a cache key
Sourcepub async fn put(&self, key: CacheKey, result: CachedResult)
pub async fn put(&self, key: CacheKey, result: CachedResult)
Store a result in the cache
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Get current memory usage in bytes
Sourcepub fn stats(&self) -> L2CacheStats
pub fn stats(&self) -> L2CacheStats
Get cache statistics
Sourcepub fn flush_to_disk(&self) -> Result<usize, Error>
pub fn flush_to_disk(&self) -> Result<usize, Error>
Flush memory entries to mmap (for graceful shutdown)
Sourcepub fn load_from_disk(&self) -> Result<usize, Error>
pub fn load_from_disk(&self) -> Result<usize, Error>
Load entries from mmap on startup
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for L2WarmCache
impl !RefUnwindSafe for L2WarmCache
impl Send for L2WarmCache
impl Sync for L2WarmCache
impl Unpin for L2WarmCache
impl UnsafeUnpin for L2WarmCache
impl UnwindSafe for L2WarmCache
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