pub struct QueryShapeCache { /* private fields */ }Expand description
Bounded LRU cache for SQL templates and value-free bind instructions.
Bind values are deliberately never cached. Template lookup compares the
complete structured key, preserving correctness across hash collisions.
The legacy intern entry point compares the complete SQL text.
Implementations§
Source§impl QueryShapeCache
impl QueryShapeCache
pub fn new(capacity: usize) -> Result<QueryShapeCache, ConfigError>
Sourcepub fn intern(&self, query: RenderedPgQuery) -> (RenderedPgQuery, bool)
pub fn intern(&self, query: RenderedPgQuery) -> (RenderedPgQuery, bool)
Reuses the cached SQL allocation when this exact shape is present.
Sourcepub fn render_list<E>(
&self,
plan: &QueryPlan<E>,
) -> Result<(RenderedPgQuery, bool), RenderError>where
E: SearchEntity,
pub fn render_list<E>(
&self,
plan: &QueryPlan<E>,
) -> Result<(RenderedPgQuery, bool), RenderError>where
E: SearchEntity,
Renders on a miss; on a hit, only rebuilds this request’s bind values.
pub fn render_cluster<E>(
&self,
plan: &QueryPlan<E>,
options: Option<&SearchOptions<E>>,
) -> Result<(RenderedPgQuery, bool), RenderError>where
E: SearchEntity,
pub fn render_sum<E>(
&self,
plan: &QueryPlan<E>,
field: FieldId,
) -> Result<(RenderedPgQuery, bool), RenderError>where
E: SearchEntity,
pub fn render_window_list<E>(
&self,
plan: &QueryPlan<E>,
) -> Result<(RenderedPgQuery, bool), RenderError>where
E: SearchEntity,
pub fn stats(&self) -> ShapeCacheStats
pub fn clear(&self)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for QueryShapeCache
impl RefUnwindSafe for QueryShapeCache
impl Send for QueryShapeCache
impl Sync for QueryShapeCache
impl Unpin for QueryShapeCache
impl UnsafeUnpin for QueryShapeCache
impl UnwindSafe for QueryShapeCache
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