pub struct CachedResult {
pub fingerprint: QueryFingerprint,
pub column_names: Vec<String>,
pub rows: CompactArc<Vec<Row>>,
pub predicate: Option<Expression>,
pub cached_at: Instant,
pub last_accessed: Instant,
pub access_count: u64,
}Expand description
Cached query result with metadata
Fields§
§fingerprint: QueryFingerprintThe fingerprint identifying this query pattern
column_names: Vec<String>Column names in order
rows: CompactArc<Vec<Row>>Cached rows (Arc for zero-copy sharing on cache hits)
predicate: Option<Expression>The original WHERE predicate (for subsumption checking)
cached_at: InstantWhen this entry was cached
last_accessed: InstantLast access time (for LRU eviction)
access_count: u64Access count
Implementations§
Source§impl CachedResult
impl CachedResult
Sourcepub fn new(
fingerprint: QueryFingerprint,
column_names: Vec<String>,
rows: Vec<Row>,
predicate: Option<Expression>,
) -> Self
pub fn new( fingerprint: QueryFingerprint, column_names: Vec<String>, rows: Vec<Row>, predicate: Option<Expression>, ) -> Self
Create a new cached result
Sourcepub fn new_with_arc(
fingerprint: QueryFingerprint,
column_names: Vec<String>,
rows: CompactArc<Vec<Row>>,
predicate: Option<Expression>,
) -> Self
pub fn new_with_arc( fingerprint: QueryFingerprint, column_names: Vec<String>, rows: CompactArc<Vec<Row>>, predicate: Option<Expression>, ) -> Self
Create a new cached result with pre-wrapped Arc (avoids clone)
Use this when the caller already has an CompactArc<Vec
Sourcepub fn is_expired(&self, ttl: Duration) -> bool
pub fn is_expired(&self, ttl: Duration) -> bool
Check if this cached result has expired
Sourcepub fn record_access(&mut self)
pub fn record_access(&mut self)
Record an access to this cached result
Trait Implementations§
Source§impl Clone for CachedResult
impl Clone for CachedResult
Source§fn clone(&self) -> CachedResult
fn clone(&self) -> CachedResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CachedResult
impl RefUnwindSafe for CachedResult
impl Send for CachedResult
impl Sync for CachedResult
impl Unpin for CachedResult
impl UnwindSafe for CachedResult
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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