pub struct CachedResult {
pub result: Arc<Vec<JsonbValue>>,
pub accessed_views: Box<[ViewName]>,
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<[ViewName]>Which views/tables this query accesses.
Format: [ViewName::from("v_user"), ViewName::from("v_post")]
Stored as a boxed slice of ViewName (each backed by Arc<str>)
so cloning a name into the reverse index is a cheap atomic ref-count
bump rather than a fresh heap allocation. 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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more