pub struct SearchCache { /* private fields */ }Expand description
Cache for search results
Implementations§
Source§impl SearchCache
impl SearchCache
Sourcepub fn new(config: CacheConfig) -> Self
pub fn new(config: CacheConfig) -> Self
Create a new search cache with the given configuration
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a cache with default configuration
Sourcepub async fn get_search(
&self,
query: &str,
region: &str,
safe_search: &str,
) -> Option<SearchResponse>
pub async fn get_search( &self, query: &str, region: &str, safe_search: &str, ) -> Option<SearchResponse>
Get a cached search response
Sourcepub async fn set_search(
&self,
query: &str,
region: &str,
safe_search: &str,
response: SearchResponse,
)
pub async fn set_search( &self, query: &str, region: &str, safe_search: &str, response: SearchResponse, )
Cache a search response
Sourcepub async fn get_page(
&self,
url: &str,
selector: Option<&str>,
) -> Option<PageContent>
pub async fn get_page( &self, url: &str, selector: Option<&str>, ) -> Option<PageContent>
Get cached page content
Sourcepub async fn set_page(
&self,
url: &str,
selector: Option<&str>,
content: PageContent,
)
pub async fn set_page( &self, url: &str, selector: Option<&str>, content: PageContent, )
Cache page content
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get statistics about the cache
Trait Implementations§
Source§impl Clone for SearchCache
impl Clone for SearchCache
Source§fn clone(&self) -> SearchCache
fn clone(&self) -> SearchCache
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 moreAuto Trait Implementations§
impl Freeze for SearchCache
impl !RefUnwindSafe for SearchCache
impl Send for SearchCache
impl Sync for SearchCache
impl Unpin for SearchCache
impl !UnwindSafe for SearchCache
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