pub struct QueryResultCache { /* private fields */ }Expand description
Thread-safe cache for query results
Caches the actual result rows and schema from SELECT queries. Results are invalidated when any referenced table is modified.
Implementations§
Source§impl QueryResultCache
impl QueryResultCache
Sourcepub fn get(
&self,
signature: &QuerySignature,
) -> Option<(Vec<Row>, CombinedSchema)>
pub fn get( &self, signature: &QuerySignature, ) -> Option<(Vec<Row>, CombinedSchema)>
Try to get cached result for a query
Sourcepub fn insert(
&self,
signature: QuerySignature,
rows: Vec<Row>,
schema: CombinedSchema,
tables: HashSet<String>,
)
pub fn insert( &self, signature: QuerySignature, rows: Vec<Row>, schema: CombinedSchema, tables: HashSet<String>, )
Insert query result into cache with table dependencies
Sourcepub fn contains(&self, signature: &QuerySignature) -> bool
pub fn contains(&self, signature: &QuerySignature) -> bool
Check if signature is cached
Sourcepub fn invalidate_table(&self, table: &str)
pub fn invalidate_table(&self, table: &str)
Invalidate all queries touching a specific table
This should be called when a table is modified (INSERT/UPDATE/DELETE)
Sourcepub fn invalidate_all(&self)
pub fn invalidate_all(&self)
Invalidate entire cache (e.g., on any write when not tracking dependencies)
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Auto Trait Implementations§
impl !Freeze for QueryResultCache
impl RefUnwindSafe for QueryResultCache
impl Send for QueryResultCache
impl Sync for QueryResultCache
impl Unpin 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> 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