Caching And Redis
Configure response caching, stale-while-revalidate, Redis backend selection, and invalidation.
Response cache
caching:
disable: false
ttl: 3600
fresh_ttl: 300
exclude_tables:
- audit_logsttl is the hard expiry. fresh_ttl controls stale-while-revalidate behavior. Mutations invalidate cache entries through tracked table and primary-key references.
TestCacheKeyBuilder_DatabaseIsolation
core/cache_key_test.go:337TestRedisCache_PerEntryTTLsCapButDoNotExtendDefaults
serv/cache_redis_test.go:180Cache keys include query/APQ identity, variables, role, user identity, and database scope. This is important in multi-database deployments: the same GraphQL operation against two source databases must not share a response entry.
TestCacheKeyBuilder_RoleIsolation
core/cache_key_test.go:88TestBuildCacheKey_DatabaseScope
core/cache_key_test.go:350Redis backend
redis:
url: ${REDIS_URL}Redis is useful when multiple GraphJin instances need shared cache state.
Remote fragments and filesystems
Remote fragments, OpenAPI calls, and filesystem tables add source-specific cache refs. Filesystem list queries include prefix refs so a write to users/1/avatar.png can invalidate both the exact key and affected list prefixes.
TestRemoteFragmentRefs_FilesystemListIncludesRootPrefix
core/cache_response_test.go:61TestRedisCache_FilterExcludedSourceScopedRefs
serv/cache_redis_test.go:210