Status: ✅ CompleteDocumentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Spec: PF-51 Caching Layer & Strategy
Purpose
Centralized in-memory cache for query results, configuration, and reference data. All keys are tenant-scoped:org-{orgId}:{namespace}:{key}.
Public API
| Export | Type | Description |
|---|---|---|
| cacheService | CacheService | get, set, delete, clear(pattern), invalidate(pattern) |
| useCachedQuery | hook | TanStack Query-backed cache for React |
| createCacheKey | function | Build full key from orgId, namespace, key |
| requireOrganizationId | function | Throw if missing org |
| warmCache | function | Warm cache for an organization (async) |
| getCacheStats | function | Hit/miss counts and hit rate (programmatic) |
| invalidateCacheForUser | function | Invalidate keys for org-:user-:* |
| purgeCacheForDeactivatedUser | function | Same as invalidateCacheForUser |
Key format
- Full key:
org-{organizationId}:{namespace}:{key}. - Organization ID is required; omit only when using helpers that inject it (e.g. useCachedQuery uses current org from context).
- Missing org throws: “Cache requires organization context”.
Usage
Security
- No PHI/PII in cache keys or values per policy.
- Tenant isolation enforced by key format and org validation.
- Cache is cleared on sign-out (wired in ResponsiveNav).
- User cache is invalidated on role assignment changes (wired in PermissionService).