pub struct AdvancedQueryCache { /* private fields */ }Expand description
Advanced query cache with smart invalidation
Implementations§
Source§impl AdvancedQueryCache
impl AdvancedQueryCache
Sourcepub fn new(
config: AdvancedQueryCacheConfig,
) -> (Self, UnboundedReceiver<InvalidationMessage>)
pub fn new( config: AdvancedQueryCacheConfig, ) -> (Self, UnboundedReceiver<InvalidationMessage>)
Create a new advanced query cache
Sourcepub fn new_with_receiver() -> (Self, UnboundedReceiver<InvalidationMessage>)
pub fn new_with_receiver() -> (Self, UnboundedReceiver<InvalidationMessage>)
Create with default configuration
Sourcepub fn put(
&self,
key: QueryKey,
data: Vec<u8>,
dependencies: Vec<TableDependency>,
)
pub fn put( &self, key: QueryKey, data: Vec<u8>, dependencies: Vec<TableDependency>, )
Store result in cache
Sourcepub fn invalidate_by_table(&self, table: &TableDependency)
pub fn invalidate_by_table(&self, table: &TableDependency)
Invalidate cache entries by table dependency
Sourcepub fn invalidate_key(&self, key: &QueryKey)
pub fn invalidate_key(&self, key: &QueryKey)
Invalidate specific query key
Sourcepub fn stats(&self) -> AdvancedCacheStats
pub fn stats(&self) -> AdvancedCacheStats
Get cache statistics
Sourcepub fn get_hot_queries_needing_refresh(&self) -> Vec<QueryKey>
pub fn get_hot_queries_needing_refresh(&self) -> Vec<QueryKey>
Get hot queries that need background refresh
Sourcepub fn mark_refreshed(&self, key: &QueryKey)
pub fn mark_refreshed(&self, key: &QueryKey)
Mark a query as refreshed
Sourcepub fn invalidation_sender(&self) -> UnboundedSender<InvalidationMessage>
pub fn invalidation_sender(&self) -> UnboundedSender<InvalidationMessage>
Get the invalidation sender
Sourcepub fn clear_expired(&self) -> usize
pub fn clear_expired(&self) -> usize
Clear expired entries
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AdvancedQueryCache
impl !RefUnwindSafe for AdvancedQueryCache
impl Send for AdvancedQueryCache
impl Sync for AdvancedQueryCache
impl Unpin for AdvancedQueryCache
impl UnsafeUnpin for AdvancedQueryCache
impl !UnwindSafe for AdvancedQueryCache
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.