pub struct PlanCache { /* private fields */ }Expand description
LRU cache for compiled physical plans.
The cache stores physical plans keyed by their logical plan fingerprint. When the cache is full, the least recently used entry is evicted.
Implementations§
Source§impl PlanCache
impl PlanCache
Sourcepub fn default_size() -> Self
pub fn default_size() -> Self
Creates a plan cache with default size (64 entries).
Sourcepub fn get(&mut self, fingerprint: u64) -> Option<&PhysicalPlan>
pub fn get(&mut self, fingerprint: u64) -> Option<&PhysicalPlan>
Gets a cached plan by fingerprint, or returns None if not cached.
Sourcepub fn insert(&mut self, fingerprint: u64, plan: PhysicalPlan)
pub fn insert(&mut self, fingerprint: u64, plan: PhysicalPlan)
Inserts a plan into the cache. If the cache is full, evicts the least recently used entry.
Sourcepub fn get_or_insert_with<F>(
&mut self,
fingerprint: u64,
compile: F,
) -> &PhysicalPlanwhere
F: FnOnce() -> PhysicalPlan,
pub fn get_or_insert_with<F>(
&mut self,
fingerprint: u64,
compile: F,
) -> &PhysicalPlanwhere
F: FnOnce() -> PhysicalPlan,
Gets a cached plan or compiles and caches a new one.
Sourcepub fn invalidate_table(&mut self, _table: &str)
pub fn invalidate_table(&mut self, _table: &str)
Invalidates all cached plans for a specific table. Call this when table schema or data changes significantly.
Auto Trait Implementations§
impl Freeze for PlanCache
impl RefUnwindSafe for PlanCache
impl Send for PlanCache
impl Sync for PlanCache
impl Unpin for PlanCache
impl UnwindSafe for PlanCache
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