pub struct QueryCache { /* private fields */ }Expand description
Query cache with similarity-based retrieval
Implementations§
Source§impl QueryCache
impl QueryCache
Sourcepub fn new(config: QueryCacheConfig) -> RragResult<Self>
pub fn new(config: QueryCacheConfig) -> RragResult<Self>
Create new query cache
Sourcepub fn get_results(&self, query: &str) -> Option<QueryCacheEntry>
pub fn get_results(&self, query: &str) -> Option<QueryCacheEntry>
Get cached results for query
Sourcepub fn cache_results(
&mut self,
query: String,
results: Vec<CachedSearchResult>,
generated_answer: Option<String>,
embedding_hash: String,
) -> RragResult<()>
pub fn cache_results( &mut self, query: String, results: Vec<CachedSearchResult>, generated_answer: Option<String>, embedding_hash: String, ) -> RragResult<()>
Cache query results with intelligent deduplication
Sourcepub fn get_insights(&self) -> QueryCacheInsights
pub fn get_insights(&self) -> QueryCacheInsights
Get cache insights
Trait Implementations§
Source§impl Cache<String, QueryCacheEntry> for QueryCache
impl Cache<String, QueryCacheEntry> for QueryCache
Source§fn put(&mut self, key: String, value: QueryCacheEntry) -> RragResult<()>
fn put(&mut self, key: String, value: QueryCacheEntry) -> RragResult<()>
Put value into cache
Source§fn stats(&self) -> CacheStats
fn stats(&self) -> CacheStats
Get cache statistics
Auto Trait Implementations§
impl Freeze for QueryCache
impl RefUnwindSafe for QueryCache
impl Send for QueryCache
impl Sync for QueryCache
impl Unpin for QueryCache
impl UnwindSafe for QueryCache
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