pub struct SemanticCacheConfig {
pub threshold: f32,
pub max_entries: usize,
pub ttl: Option<Duration>,
}Expand description
Semantic cache configuration.
Fields§
§threshold: f32Minimum cosine similarity for a semantic hit. Conservative default: a too-low threshold serves semantically-nearbut-different queries.
max_entries: usizeMax entries; the oldest are evicted FIFO (same policy as lc-agents’
MemoryCache).
ttl: Option<Duration>Optional TTL: entries older than this are treated as misses (corpus
updates invalidate results; pair with invalidate() for explicit
invalidation).
Implementations§
Source§impl SemanticCacheConfig
impl SemanticCacheConfig
Sourcepub fn with_threshold(self, threshold: f32) -> Self
pub fn with_threshold(self, threshold: f32) -> Self
Sets the semantic-hit threshold.
Sourcepub fn with_max_entries(self, max_entries: usize) -> Self
pub fn with_max_entries(self, max_entries: usize) -> Self
Sets the max entry count (FIFO eviction).
Trait Implementations§
Source§impl Clone for SemanticCacheConfig
impl Clone for SemanticCacheConfig
Source§fn clone(&self) -> SemanticCacheConfig
fn clone(&self) -> SemanticCacheConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SemanticCacheConfig
impl Debug for SemanticCacheConfig
Auto Trait Implementations§
impl Freeze for SemanticCacheConfig
impl RefUnwindSafe for SemanticCacheConfig
impl Send for SemanticCacheConfig
impl Sync for SemanticCacheConfig
impl Unpin for SemanticCacheConfig
impl UnsafeUnpin for SemanticCacheConfig
impl UnwindSafe for SemanticCacheConfig
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