pub struct QueryResultCache { /* private fields */ }Expand description
Caches SPARQL query results keyed by a (dataset_id, query_hash) pair.
Internally delegates to TripleCache<(String, u64), QueryCacheEntry>.
Implementations§
Source§impl QueryResultCache
impl QueryResultCache
Sourcepub fn new(capacity: usize, ttl: Duration) -> Self
pub fn new(capacity: usize, ttl: Duration) -> Self
Create a new result cache with capacity entries and a TTL.
Sourcepub fn put(
&self,
dataset_id: &str,
query: &str,
rows: Vec<SparqlRow>,
variables: Vec<String>,
accessed_predicates: Vec<String>,
)
pub fn put( &self, dataset_id: &str, query: &str, rows: Vec<SparqlRow>, variables: Vec<String>, accessed_predicates: Vec<String>, )
Store a result set for (dataset_id, query).
Sourcepub fn get(&self, dataset_id: &str, query: &str) -> Option<QueryCacheEntry>
pub fn get(&self, dataset_id: &str, query: &str) -> Option<QueryCacheEntry>
Look up a cached result for (dataset_id, query).
Sourcepub fn invalidate_by_predicate(
&self,
dataset_id: &str,
predicate: &str,
) -> usize
pub fn invalidate_by_predicate( &self, dataset_id: &str, predicate: &str, ) -> usize
Invalidate all entries for dataset_id that accessed predicate.
Sourcepub fn invalidate_dataset(&self, dataset_id: &str) -> usize
pub fn invalidate_dataset(&self, dataset_id: &str) -> usize
Invalidate all entries for dataset_id.
pub fn is_empty(&self) -> bool
Sourcepub fn stats(&self) -> Arc<CacheStats>
pub fn stats(&self) -> Arc<CacheStats>
Shared stats.
Auto Trait Implementations§
impl !Freeze for QueryResultCache
impl RefUnwindSafe for QueryResultCache
impl Send for QueryResultCache
impl Sync for QueryResultCache
impl Unpin for QueryResultCache
impl UnsafeUnpin for QueryResultCache
impl UnwindSafe for QueryResultCache
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