pub struct WebSearchCache { /* private fields */ }Implementations§
Source§impl WebSearchCache
impl WebSearchCache
pub async fn open(path: &str, ttl: Duration) -> Result<Self, WebSearchError>
Sourcepub async fn open_memory(ttl: Duration) -> Result<Self, WebSearchError>
pub async fn open_memory(ttl: Duration) -> Result<Self, WebSearchError>
In-memory cache used for tests.
pub fn ttl(&self) -> Duration
pub fn key(provider: &str, query: &str, params_canonical: &str) -> String
pub async fn get( &self, key: &str, ) -> Result<Option<WebSearchResult>, WebSearchError>
pub async fn put( &self, key: &str, value: &WebSearchResult, ) -> Result<(), WebSearchError>
pub async fn purge_expired(&self) -> Result<u64, WebSearchError>
Sourcepub async fn clear(&self) -> Result<u64, WebSearchError>
pub async fn clear(&self) -> Result<u64, WebSearchError>
Phase 95 FU#1 — flush every cache entry. Returns the row
count deleted (informational; callers typically don’t act
on it). Used by nexo-plugin-web-search’s
admin/cache_clear RPC so operators can force a refresh
after rotating provider keys or scope changes.
Sourcepub async fn stats(&self) -> Result<CacheStats, WebSearchError>
pub async fn stats(&self) -> Result<CacheStats, WebSearchError>
Phase 95 FU#1 — report the row count currently in the
cache + the sqlite db size on disk (when the cache is
file-backed; 0 for :memory:). Provides operator-facing
“cache size” telemetry the admin UI surfaces.
Auto Trait Implementations§
impl Freeze for WebSearchCache
impl !RefUnwindSafe for WebSearchCache
impl Send for WebSearchCache
impl Sync for WebSearchCache
impl Unpin for WebSearchCache
impl UnsafeUnpin for WebSearchCache
impl !UnwindSafe for WebSearchCache
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> 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