pub struct QueryCache { /* private fields */ }Expand description
Query cache for parsed and optimized plans.
Implementations§
Source§impl QueryCache
impl QueryCache
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Creates a new query cache with the specified capacity.
The capacity is shared between parsed and optimized caches (each gets half the capacity).
Sourcepub fn disabled() -> Self
pub fn disabled() -> Self
Creates a disabled cache (for testing or when caching is not desired).
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns whether caching is enabled.
Sourcepub fn get_parsed(&self, key: &CacheKey) -> Option<LogicalPlan>
pub fn get_parsed(&self, key: &CacheKey) -> Option<LogicalPlan>
Gets a parsed plan from the cache.
Sourcepub fn put_parsed(&self, key: CacheKey, plan: LogicalPlan)
pub fn put_parsed(&self, key: CacheKey, plan: LogicalPlan)
Puts a parsed plan into the cache.
Sourcepub fn get_optimized(&self, key: &CacheKey) -> Option<LogicalPlan>
pub fn get_optimized(&self, key: &CacheKey) -> Option<LogicalPlan>
Gets an optimized plan from the cache.
Sourcepub fn put_optimized(&self, key: CacheKey, plan: LogicalPlan)
pub fn put_optimized(&self, key: CacheKey, plan: LogicalPlan)
Puts an optimized plan into the cache.
Sourcepub fn invalidate(&self, key: &CacheKey)
pub fn invalidate(&self, key: &CacheKey)
Invalidates a specific query from both caches.
Sourcepub fn clear(&self)
pub fn clear(&self)
Clears all cached entries and increments the invalidation counter (only when the cache was non-empty).
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Returns cache statistics.
Sourcepub fn heap_memory_bytes(&self) -> (usize, usize, usize)
pub fn heap_memory_bytes(&self) -> (usize, usize, usize)
Estimates heap memory used by both caches.
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Resets hit/miss counters and invalidation counter.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for QueryCache
impl !RefUnwindSafe for QueryCache
impl Send for QueryCache
impl Sync for QueryCache
impl Unpin for QueryCache
impl UnsafeUnpin for QueryCache
impl UnwindSafe 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
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 more