pub struct CacheConfig {
pub max_entries: usize,
pub ttl: Duration,
pub key_prefix: String,
pub semantic_matching: bool,
pub similarity_threshold: f32,
}Expand description
Configuration for cache behavior
Fields§
§max_entries: usizeMaximum number of entries (for memory cache)
ttl: DurationTime-to-live for cache entries
key_prefix: StringPrefix for cache keys (for Redis/Valkey)
semantic_matching: boolWhether to enable semantic matching (requires embeddings)
similarity_threshold: f32Similarity threshold for semantic matching (0.0 to 1.0)
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn max_entries(self, max: usize) -> Self
pub fn max_entries(self, max: usize) -> Self
Set maximum entries
Sourcepub fn key_prefix(self, prefix: impl Into<String>) -> Self
pub fn key_prefix(self, prefix: impl Into<String>) -> Self
Set key prefix
Sourcepub fn with_semantic_matching(self, threshold: f32) -> Self
pub fn with_semantic_matching(self, threshold: f32) -> Self
Enable semantic matching
Sourcepub fn short_lived() -> Self
pub fn short_lived() -> Self
Config for short-lived cache (5 minutes)
Sourcepub fn long_lived() -> Self
pub fn long_lived() -> Self
Config for long-lived cache (24 hours)
Sourcepub fn for_agents() -> Self
pub fn for_agents() -> Self
Config for agent responses
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§fn clone(&self) -> CacheConfig
fn clone(&self) -> CacheConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 CacheConfig
impl Debug for CacheConfig
Auto Trait Implementations§
impl Freeze for CacheConfig
impl RefUnwindSafe for CacheConfig
impl Send for CacheConfig
impl Sync for CacheConfig
impl Unpin for CacheConfig
impl UnsafeUnpin for CacheConfig
impl UnwindSafe for CacheConfig
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