pub struct LruQueryPlanCache { /* private fields */ }Expand description
Query plan cache with LRU eviction
Caches compiled execution plans to avoid repeated query compilation and optimization overhead.
This is the full-featured LRU implementation backed by the lru crate and
SciRS2 metrics. For a simpler, self-contained cache see QueryPlanCache below.
Implementations§
Source§impl LruQueryPlanCache
impl LruQueryPlanCache
Sourcepub fn new(config: CacheConfig) -> Self
pub fn new(config: CacheConfig) -> Self
Create a new query plan cache
Sourcepub fn get(&self, query: &str) -> Option<CachedPlan>
pub fn get(&self, query: &str) -> Option<CachedPlan>
Get a cached plan for a query string
Sourcepub fn put(
&self,
query: &str,
plan: ExecutionPlan,
estimated_cost: f64,
) -> Result<(), OxirsError>
pub fn put( &self, query: &str, plan: ExecutionPlan, estimated_cost: f64, ) -> Result<(), OxirsError>
Put a compiled plan into the cache
Sourcepub fn remove(&self, query: &str) -> Option<CachedPlan>
pub fn remove(&self, query: &str) -> Option<CachedPlan>
Remove a cached plan
Sourcepub fn clear(&self) -> Result<(), OxirsError>
pub fn clear(&self) -> Result<(), OxirsError>
Clear all cached plans
Sourcepub fn statistics(&self) -> CacheStatistics
pub fn statistics(&self) -> CacheStatistics
Get cache statistics
Sourcepub fn persist(&self) -> Result<(), OxirsError>
pub fn persist(&self) -> Result<(), OxirsError>
Persist cache to disk
Sourcepub fn load(&self) -> Result<(), OxirsError>
pub fn load(&self) -> Result<(), OxirsError>
Load cache from disk
Sourcepub fn update_execution_time(
&self,
query: &str,
execution_time_ms: f64,
) -> Result<(), OxirsError>
pub fn update_execution_time( &self, query: &str, execution_time_ms: f64, ) -> Result<(), OxirsError>
Update execution time for a cached plan
Auto Trait Implementations§
impl !Freeze for LruQueryPlanCache
impl RefUnwindSafe for LruQueryPlanCache
impl Send for LruQueryPlanCache
impl Sync for LruQueryPlanCache
impl Unpin for LruQueryPlanCache
impl UnsafeUnpin for LruQueryPlanCache
impl UnwindSafe for LruQueryPlanCache
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