pub struct CacheService { /* private fields */ }Expand description
Cache service for storing and retrieving cached data
Implementations§
Source§impl CacheService
impl CacheService
Sourcepub fn from_config(config: CacheConfig) -> Self
pub fn from_config(config: CacheConfig) -> Self
Create a new cache service with the given config
Sourcepub fn initialize(&self) -> Result<()>
pub fn initialize(&self) -> Result<()>
Initialize the cache directories
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if caching is enabled
Sourcepub fn get_search(
&self,
query: &SearchQuery,
source: &str,
) -> CacheResult<SearchResponse>
pub fn get_search( &self, query: &SearchQuery, source: &str, ) -> CacheResult<SearchResponse>
Read a cached search response
Sourcepub fn set_search(
&self,
source: &str,
query: &SearchQuery,
response: &SearchResponse,
)
pub fn set_search( &self, source: &str, query: &SearchQuery, response: &SearchResponse, )
Cache a search response
Sourcepub fn get_citations(
&self,
paper_id: &str,
source: &str,
max_results: usize,
) -> CacheResult<SearchResponse>
pub fn get_citations( &self, paper_id: &str, source: &str, max_results: usize, ) -> CacheResult<SearchResponse>
Read a cached citation lookup
Sourcepub fn set_citations(
&self,
source: &str,
paper_id: &str,
response: &SearchResponse,
)
pub fn set_citations( &self, source: &str, paper_id: &str, response: &SearchResponse, )
Cache a citation lookup response
Sourcepub fn clear_searches(&self) -> Result<()>
pub fn clear_searches(&self) -> Result<()>
Clear only search cache
Sourcepub fn clear_citations(&self) -> Result<()>
pub fn clear_citations(&self) -> Result<()>
Clear only citation cache
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Source§impl Clone for CacheService
impl Clone for CacheService
Source§fn clone(&self) -> CacheService
fn clone(&self) -> CacheService
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 CacheService
impl Debug for CacheService
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more