pub struct CachedResult {
pub result: Arc<Vec<JsonbValue>>,
pub accessed_views: Box<[String]>,
pub cached_at: u64,
pub ttl_seconds: u64,
pub entity_refs: Box<[(String, String)]>,
pub is_list_query: bool,
}Expand description
Cached query result with metadata.
Stores the query result along with tracking information for TTL expiry, view-based invalidation, and monitoring.
Fields§
§result: Arc<Vec<JsonbValue>>The actual query result (JSONB array from database).
Wrapped in Arc for cheap cloning on cache hits (zero-copy).
accessed_views: Box<[String]>Which views/tables this query accesses.
Format: vec!["v_user", "v_post"]
Stored as a boxed slice (no excess capacity) since views are fixed
at put() time and never modified.
cached_at: u64When this entry was cached (Unix timestamp in seconds).
Wall-clock timestamp for debugging. TTL enforcement is handled by moka
internally via CacheEntryExpiry.
ttl_seconds: u64Per-entry TTL in seconds.
Overrides CacheConfig::ttl_seconds when set via put(..., Some(ttl)).
Read by CacheEntryExpiry::expire_after_create to tell moka the expiry.
entity_refs: Box<[(String, String)]>Entity references for selective entity-level invalidation.
Contains one (entity_type, entity_id) pair per row in result that has
a valid string in its "id" field. Empty for queries with no id column
or when put() is called without an entity_type.
Used by the eviction listener to clean up entity_index on eviction.
is_list_query: boolTrue when result.len() > 1 at put time.
Used by invalidate_list_queries() to avoid evicting single-entity
point-lookup entries on CREATE mutations.
Trait Implementations§
Source§impl Clone for CachedResult
impl Clone for CachedResult
Source§fn clone(&self) -> CachedResult
fn clone(&self) -> CachedResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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