pub struct L3SemanticCache { /* private fields */ }Expand description
L3 semantic cache (vector similarity)
This cache stores query embeddings and uses cosine similarity to find matches even when queries are not identical.
Implementations§
Source§impl L3SemanticCache
impl L3SemanticCache
Sourcepub async fn get(
&self,
query: &str,
context: &CacheContext,
) -> Option<CachedResult>
pub async fn get( &self, query: &str, context: &CacheContext, ) -> Option<CachedResult>
Look up a query using semantic similarity
Sourcepub async fn put(
&self,
query: &str,
context: &CacheContext,
result: CachedResult,
)
pub async fn put( &self, query: &str, context: &CacheContext, result: CachedResult, )
Store a query and result in the semantic cache
Sourcepub fn stats(&self) -> L3CacheStats
pub fn stats(&self) -> L3CacheStats
Get cache statistics
Sourcepub async fn health_check(&self) -> bool
pub async fn health_check(&self) -> bool
Check if the embedding service is available
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for L3SemanticCache
impl !RefUnwindSafe for L3SemanticCache
impl Send for L3SemanticCache
impl Sync for L3SemanticCache
impl Unpin for L3SemanticCache
impl UnsafeUnpin for L3SemanticCache
impl !UnwindSafe for L3SemanticCache
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