pub struct CacheManager { /* private fields */ }Expand description
Multi-tier cache orchestrator
This is the main interface for cache operations. It coordinates lookups and writes across L1 and L2 cache tiers.
Implementations§
Source§impl CacheManager
impl CacheManager
Sourcepub async fn lookup(&self, request: &CacheableRequest) -> CacheLookupResult
pub async fn lookup(&self, request: &CacheableRequest) -> CacheLookupResult
Sourcepub async fn store(&self, request: &CacheableRequest, response: CachedResponse)
pub async fn store(&self, request: &CacheableRequest, response: CachedResponse)
Store a response in the cache
Writes to both L1 and L2 asynchronously (non-blocking). This should be called after receiving a response from the LLM provider.
§Performance
Non-blocking, returns immediately. Cache writes happen in background.
Sourcepub async fn store_with_ttl(
&self,
request: &CacheableRequest,
response: CachedResponse,
l2_ttl_seconds: u64,
)
pub async fn store_with_ttl( &self, request: &CacheableRequest, response: CachedResponse, l2_ttl_seconds: u64, )
Store with custom L2 TTL
Sourcepub async fn invalidate(&self, request: &CacheableRequest)
pub async fn invalidate(&self, request: &CacheableRequest)
Invalidate a cache entry across all tiers
Sourcepub async fn health_check(&self) -> CacheHealthStatus
pub async fn health_check(&self) -> CacheHealthStatus
Check health of cache tiers
Sourcepub fn metrics_snapshot(&self) -> MetricsSnapshot
pub fn metrics_snapshot(&self) -> MetricsSnapshot
Get metrics snapshot
Sourcepub fn l1_entry_count(&self) -> u64
pub fn l1_entry_count(&self) -> u64
Get L1 cache entry count
Sourcepub async fn l2_approximate_size(&self) -> Option<usize>
pub async fn l2_approximate_size(&self) -> Option<usize>
Get L2 cache approximate size
Sourcepub fn metrics(&self) -> &CacheMetrics
pub fn metrics(&self) -> &CacheMetrics
Get shared metrics instance
Trait Implementations§
Source§impl Clone for CacheManager
impl Clone for CacheManager
Auto Trait Implementations§
impl Freeze for CacheManager
impl !RefUnwindSafe for CacheManager
impl Send for CacheManager
impl Sync for CacheManager
impl Unpin for CacheManager
impl !UnwindSafe for CacheManager
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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