Namespace-based cache storage with hook-driven invalidation — ensuring data consistency without manual cache management.
The caching layer is built on two complementary primitives. CacheStore organizes cached data into logical namespaces — manifest cache, schema cache, configuration cache — so lookups are fast and scoped. CacheInvalidator listens to platform hooks and automatically flushes the right namespaces when modules change, settings update, plugins activate, or roles are modified.
1// Namespace-based cache storage & retrieval2
3val schemaCache = CacheStore.namespace("schema")4
5// Store a value with automatic TTL from the namespace profile6schemaCache.put("user.profile", schemaDefinition)7
8// Retrieve — returns cached value or null9val cached = schemaCache.get("user.profile")10
11// Retrieve with fallback — executes block only on cache miss12val schema = schemaCache.getOrPut("user.profile") {13 SchemaRegistry.resolve("user.profile")14}15
16// Scoped bulk operations17val allSchemas = schemaCache.getAll() // all entries in namespace18schemaCache.flush() // flush only this namespaceEvery request follows the same path — check cache first, execute only on miss, store the result, and return. Hook-driven invalidation keeps the cache consistent without manual intervention.
Incoming Request
API request arrives — route matched, policy validated
Cache Check
CacheStore checks the relevant namespace for a cached entry
Hit / Miss
Cache hit returns immediately — cache miss proceeds to execution
Execute
Query, compute, or resolve the data from source on cache miss
Store in Cache
Result written to the namespace with TTL from cache profile
Return Response
Response sent with appropriate HTTP cache headers (ETag, Cache-Control)
Incoming Request
API request arrives — route matched, policy validated
Cache Check
CacheStore checks the relevant namespace for a cached entry
Hit / Miss
Cache hit returns immediately — cache miss proceeds to execution
Execute
Query, compute, or resolve the data from source on cache miss
Store in Cache
Result written to the namespace with TTL from cache profile
Return Response
Response sent with appropriate HTTP cache headers (ETag, Cache-Control)
From namespace isolation to automatic invalidation — every layer of the cache is designed for correctness and speed.
Cache entries are grouped by namespace. Flushing a namespace invalidates only the relevant subset, leaving unrelated caches intact.
Platform hooks trigger targeted cache invalidation. Module installs, setting changes, and role updates flush only affected namespaces.
Responses include appropriate Cache-Control, ETag, and Last-Modified headers for efficient browser and CDN-level caching.
Repeated lookups within a single request lifecycle are memoized, eliminating redundant database queries and computation.
Define TTL, storage driver, and invalidation strategy per namespace. Profiles ensure each cache type has the right behavior.
Critical platform events — deployments, migrations, and schema changes — trigger a full cache flush to guarantee consistency.