pub struct L3Entry {
pub result: CachedResult,
pub query: String,
pub embedding: Vec<f32>,
pub context: CacheContext,
pub access_count: u64,
pub last_access: Instant,
}Expand description
Entry in the L3 semantic cache
Fields§
§result: CachedResultThe cached result
query: StringOriginal query string
embedding: Vec<f32>Query embedding vector
context: CacheContextCache context
access_count: u64Access count
last_access: InstantLast access time
Implementations§
Source§impl L3Entry
impl L3Entry
Sourcepub fn new(
query: String,
embedding: Vec<f32>,
context: CacheContext,
result: CachedResult,
) -> Self
pub fn new( query: String, embedding: Vec<f32>, context: CacheContext, result: CachedResult, ) -> Self
Create a new L3 cache entry
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if this entry has expired
Sourcepub fn similarity(&self, other: &[f32]) -> f32
pub fn similarity(&self, other: &[f32]) -> f32
Compute cosine similarity with another embedding
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for L3Entry
impl RefUnwindSafe for L3Entry
impl Send for L3Entry
impl Sync for L3Entry
impl Unpin for L3Entry
impl UnsafeUnpin for L3Entry
impl UnwindSafe for L3Entry
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