pub struct QueryCache { /* private fields */ }Expand description
Query result cache with LRU eviction
Implementations§
Source§impl QueryCache
impl QueryCache
Sourcepub fn new(config: QueryCacheConfig) -> Self
pub fn new(config: QueryCacheConfig) -> Self
Create a new query cache
Sourcepub fn get(&self, pattern: &QueryPattern) -> Option<Vec<(Term, Term, Term)>>
pub fn get(&self, pattern: &QueryPattern) -> Option<Vec<(Term, Term, Term)>>
Get cached results for a query pattern
Sourcepub fn put(
&self,
pattern: QueryPattern,
results: Vec<(Term, Term, Term)>,
) -> Result<()>
pub fn put( &self, pattern: QueryPattern, results: Vec<(Term, Term, Term)>, ) -> Result<()>
Store results in cache
Sourcepub fn invalidate_all(&self)
pub fn invalidate_all(&self)
Invalidate all cached results
This should be called when the underlying data changes (inserts, deletes, updates)
Sourcepub fn invalidate_pattern(
&self,
subject: Option<&str>,
predicate: Option<&str>,
object: Option<&str>,
)
pub fn invalidate_pattern( &self, subject: Option<&str>, predicate: Option<&str>, object: Option<&str>, )
Invalidate cache entries matching a pattern
This is more selective than invalidate_all() - only invalidates entries that might be affected by changes to a specific triple pattern.
Sourcepub fn stats(&self) -> &QueryCacheStats
pub fn stats(&self) -> &QueryCacheStats
Get cache statistics
Sourcepub fn max_entries(&self) -> usize
pub fn max_entries(&self) -> usize
Maximum number of cached query results this cache retains before
evicting (the configured capacity, e.g. from
StoreParams::query_cache_size).
Auto Trait Implementations§
impl !Freeze for QueryCache
impl !RefUnwindSafe for QueryCache
impl !UnwindSafe for QueryCache
impl Send for QueryCache
impl Sync for QueryCache
impl Unpin for QueryCache
impl UnsafeUnpin for QueryCache
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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