pub struct CacheService { /* private fields */ }Expand description
Main caching service orchestrating multiple cache layers
Implementations§
Source§impl CacheService
impl CacheService
Sourcepub fn new(config: CacheConfig) -> RragResult<Self>
pub fn new(config: CacheConfig) -> RragResult<Self>
Create new cache service
Sourcepub async fn get_query_results(&self, query: &str) -> Option<QueryCacheEntry>
pub async fn get_query_results(&self, query: &str) -> Option<QueryCacheEntry>
Get cached query results
Sourcepub async fn cache_query_results(
&mut self,
query: String,
entry: QueryCacheEntry,
) -> RragResult<()>
pub async fn cache_query_results( &mut self, query: String, entry: QueryCacheEntry, ) -> RragResult<()>
Cache query results
Sourcepub async fn get_embedding(&self, text: &str, model: &str) -> Option<Vec<f32>>
pub async fn get_embedding(&self, text: &str, model: &str) -> Option<Vec<f32>>
Get cached embedding
Sourcepub async fn cache_embedding(
&mut self,
text: String,
model: String,
embedding: Vec<f32>,
) -> RragResult<()>
pub async fn cache_embedding( &mut self, text: String, model: String, embedding: Vec<f32>, ) -> RragResult<()>
Cache embedding
Sourcepub async fn get_semantic_results(
&self,
query: &str,
) -> Option<SemanticCacheEntry>
pub async fn get_semantic_results( &self, query: &str, ) -> Option<SemanticCacheEntry>
Get semantically similar cached results
Sourcepub async fn cache_semantic_results(
&mut self,
query: String,
entry: SemanticCacheEntry,
) -> RragResult<()>
pub async fn cache_semantic_results( &mut self, query: String, entry: SemanticCacheEntry, ) -> RragResult<()>
Cache semantic results
Sourcepub fn get_metrics(&self) -> &CacheMetrics
pub fn get_metrics(&self) -> &CacheMetrics
Get cache metrics
Sourcepub async fn maintenance(&mut self) -> RragResult<()>
pub async fn maintenance(&mut self) -> RragResult<()>
Perform cache maintenance
Auto Trait Implementations§
impl Freeze for CacheService
impl !RefUnwindSafe for CacheService
impl Send for CacheService
impl Sync for CacheService
impl Unpin for CacheService
impl !UnwindSafe for CacheService
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