pub struct ResultCache { /* private fields */ }Expand description
Result cache optimized for search results
Implementations§
Source§impl ResultCache
impl ResultCache
Sourcepub fn new(config: ResultCacheConfig) -> RragResult<Self>
pub fn new(config: ResultCacheConfig) -> RragResult<Self>
Create new result cache
Sourcepub fn get_by_params(
&self,
params_hash: &str,
) -> Option<Vec<CachedSearchResult>>
pub fn get_by_params( &self, params_hash: &str, ) -> Option<Vec<CachedSearchResult>>
Get cached results by parameters
Sourcepub fn cache_results(
&mut self,
params_hash: String,
results: Vec<CachedSearchResult>,
metadata: HashMap<String, String>,
) -> RragResult<()>
pub fn cache_results( &mut self, params_hash: String, results: Vec<CachedSearchResult>, metadata: HashMap<String, String>, ) -> RragResult<()>
Cache search results
Sourcepub fn invalidate_pattern(&mut self, pattern: &str)
pub fn invalidate_pattern(&mut self, pattern: &str)
Invalidate cache entries by pattern
Sourcepub fn get_insights(&self) -> ResultCacheInsights
pub fn get_insights(&self) -> ResultCacheInsights
Get cache insights
Trait Implementations§
Source§impl Cache<String, ResultCacheEntry> for ResultCache
impl Cache<String, ResultCacheEntry> for ResultCache
Source§fn put(&mut self, key: String, value: ResultCacheEntry) -> RragResult<()>
fn put(&mut self, key: String, value: ResultCacheEntry) -> RragResult<()>
Put value into cache
Source§fn stats(&self) -> CacheStats
fn stats(&self) -> CacheStats
Get cache statistics
Auto Trait Implementations§
impl Freeze for ResultCache
impl RefUnwindSafe for ResultCache
impl Send for ResultCache
impl Sync for ResultCache
impl Unpin for ResultCache
impl UnwindSafe for ResultCache
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