GAP-1002: @cacheControl Directive
Version: Draft
Authors: Avery Chen
Discussion: github.com/graphql/gaps/pull/1002
GAP-1002: @cacheControl Directive
This document defines a directive for expressing cache hints in a GraphQL schema.
1Overview
The directive MAY appear on object and field definitions.
Example № 1directive @cacheControl(
maxAge: Int
scope: CacheScope
) on OBJECT | FIELD_DEFINITION
enum CacheScope {
PUBLIC
PRIVATE
}
2Motivation
GraphQL services often need cache hints that are visible to a gateway without requiring custom runtime configuration for each field.
3Hint composition
When more than one hint applies, an implementation SHOULD choose the most restrictive cache policy.