pub struct QueryPlanCache { /* private fields */ }Expand description
Generic type-erased cache for storing parsed AST and plans This intentionally avoids caching results - plans are still executed
Implementations§
Source§impl QueryPlanCache
impl QueryPlanCache
Sourcepub fn get(&self, signature: &QuerySignature) -> Option<String>
pub fn get(&self, signature: &QuerySignature) -> Option<String>
Check if query is in cache and update statistics
Sourcepub fn insert(&self, signature: QuerySignature, sql: String)
pub fn insert(&self, signature: QuerySignature, sql: String)
Insert plan into cache with table metadata, evicting LRU entry if at capacity The sql should be the normalized original query
Sourcepub fn insert_with_tables(
&self,
signature: QuerySignature,
sql: String,
tables: HashSet<String>,
)
pub fn insert_with_tables( &self, signature: QuerySignature, sql: String, tables: HashSet<String>, )
Insert plan with explicit table dependencies for better invalidation
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 plans referencing a table
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Auto Trait Implementations§
impl !Freeze for QueryPlanCache
impl RefUnwindSafe for QueryPlanCache
impl Send for QueryPlanCache
impl Sync for QueryPlanCache
impl Unpin for QueryPlanCache
impl UnwindSafe for QueryPlanCache
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