Skip to main content

Module response_cache

Module response_cache 

Source
Expand description

Executor-level response cache.

Caches the final projected GraphQL response value (after RBAC filtering, projection, and envelope wrapping) to skip all redundant work on cache hits for the same user + query combination.

This is a second cache tier above the adapter-level row cache:

  • Row cache: raw JSONB rows, shared across projection shapes
  • Response cache: final serde_json::Value, keyed per (query + security context)

§Performance characteristics

Backed by moka::sync::Cache (W-TinyLFU, lock-free reads). Invalidation uses a DashMap reverse index (view name → set of keys), enabling O(k) eviction without scanning the full cache.

§Security

The response cache key includes a hash of the SecurityContext fields that affect response content (user_id, roles, tenant_id, scopes, attributes). Different RBAC scopes produce different cache entries.

Structs§

ResponseCache
Executor-level cache for projected GraphQL responses.
ResponseCacheConfig
Configuration for the response cache.

Functions§

hash_security_context
Hash the security context fields that affect response content.