Skip to main content

cache

Caches the result of a field for the specified time-to-live (TTL) in seconds. Optional key parameter allows for custom cache key generation.

directive @cache(key: String, ttl: Int!) on FIELD_DEFINITION

Arguments

cache.key ● String scalar

Optional custom cache key. If not provided, uses field path and args.

cache.ttl ● Int! non-null scalar

Time-to-live in seconds