pub struct CacheManager { /* private fields */ }Expand description
Simplified cache manager for common operations
Implementations§
Source§impl CacheManager
impl CacheManager
Sourcepub fn new(max_size: usize) -> Self
pub fn new(max_size: usize) -> Self
Create a new cache manager with separate plan and result caches
Sourcepub fn with_separate_limits(
plan_cache_size: usize,
result_cache_size: usize,
) -> Self
pub fn with_separate_limits( plan_cache_size: usize, result_cache_size: usize, ) -> Self
Create cache manager with different limits for plans and results
Sourcepub fn get_or_create<F>(
&self,
query: &str,
creator: F,
) -> Result<String, String>
pub fn get_or_create<F>( &self, query: &str, creator: F, ) -> Result<String, String>
Get or create cached query plan Note: The creator function should return the parsed query, not execute it
Sourcepub fn get_result(
&self,
signature: &QuerySignature,
) -> Option<(Vec<Row>, CombinedSchema)>
pub fn get_result( &self, signature: &QuerySignature, ) -> Option<(Vec<Row>, CombinedSchema)>
Get cached query result
Sourcepub fn insert_result(
&self,
signature: QuerySignature,
rows: Vec<Row>,
schema: CombinedSchema,
tables: HashSet<String>,
)
pub fn insert_result( &self, signature: QuerySignature, rows: Vec<Row>, schema: CombinedSchema, tables: HashSet<String>, )
Insert query result into cache
Sourcepub fn invalidate_table(&self, table_name: &str)
pub fn invalidate_table(&self, table_name: &str)
Invalidate all plans and results referencing a table
Sourcepub fn plan_stats(&self) -> CacheStats
pub fn plan_stats(&self) -> CacheStats
Get plan cache statistics
Sourcepub fn result_stats(&self) -> CacheStats
pub fn result_stats(&self) -> CacheStats
Get result cache statistics
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get combined cache statistics (for backwards compatibility)
Auto Trait Implementations§
impl Freeze for CacheManager
impl RefUnwindSafe for CacheManager
impl Send for CacheManager
impl Sync for CacheManager
impl Unpin for CacheManager
impl UnwindSafe for CacheManager
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