pub struct PlanCache { /* private fields */ }Implementations§
Source§impl PlanCache
impl PlanCache
pub fn new() -> Self
Sourcepub fn set_max_entries(&mut self, n: usize)
pub fn set_max_entries(&mut self, n: usize)
v6.5.6 — runtime cap override. Operator-tunable via
SPG_PLAN_CACHE_MAX env at startup. Minimum 1; values
above the compile-time PLAN_CACHE_MAX_ENTRIES are
clamped down to it (defensive backstop against runaway
configs).
pub fn max_entries(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn get_snapshot(&self, sql: &str) -> Option<&PreparedPlan>
pub fn get_snapshot(&self, sql: &str) -> Option<&PreparedPlan>
Read-only peek without LRU promotion. Used by introspection and v6.3.1 tests that want to inspect a cached plan’s metadata without mutating the cache.
Sourcepub fn get(&mut self, sql: &str) -> Option<&PreparedPlan>
pub fn get(&mut self, sql: &str) -> Option<&PreparedPlan>
Returns the cached plan if present and promotes it to most-
recently-used. Returns None on miss.
Sourcepub fn insert(&mut self, sql: String, plan: PreparedPlan)
pub fn insert(&mut self, sql: String, plan: PreparedPlan)
Inserts (or replaces) the plan. Evicts the oldest entry if
we’d exceed PLAN_CACHE_MAX_ENTRIES.
pub fn clear(&mut self)
Sourcepub fn evict(&mut self, sql: &str) -> Option<PreparedPlan>
pub fn evict(&mut self, sql: &str) -> Option<PreparedPlan>
v6.3.1 will use this for explicit invalidation. v6.3.0 exposes it for tests + future use.
Sourcepub fn evict_referencing(&mut self, table: &str) -> usize
pub fn evict_referencing(&mut self, table: &str) -> usize
v6.3.1 will use this to evict every plan that references a specific table.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PlanCache
impl RefUnwindSafe for PlanCache
impl Send for PlanCache
impl Sync for PlanCache
impl Unpin for PlanCache
impl UnsafeUnpin 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