GraphQL Proxy Cache Configuration
Configuration reference for the GraphQL Proxy Cache plugin (`graphql-proxy-cache`): the static configurations and parameters, each attribute with its type, whether it is required, its default and its accepted values.
Static Configurations
The gateway default configuration includes proxy cache settings for disk caching and cache zones. The file to update depends on how the gateway is deployed:
For host or Docker deployments, configure the following settings:
apisix:
proxy_cache:
cache_ttl: 10s # for caching on disk
zones:
- name: disk_cache_one
memory_size: 50m
disk_size: 1G
disk_path: /tmp/disk_cache_one
cache_levels: 1:2
# - name: disk_cache_two
# memory_size: 50m
# disk_size: 1G
# disk_path: "/tmp/disk_cache_two"
# cache_levels: "1:2"
- name: memory_cache
memory_size: 50mThen reload the gateway for changes to take effect.
In the APISIX Helm chart version 2.16.0 or later and the API7 Gateway Helm chart version 3.10.3 or later, set apisix.proxyCache.
Each chart renders this value as apisix.proxy_cache in the gateway configuration:
apisix:
proxyCache:
cacheTtl: 10s
zones:
- name: disk_cache_one
memory_size: 50m
disk_size: 1G
disk_path: /tmp/disk_cache_one
cache_levels: 1:2
- name: memory_cache
memory_size: 50mThen apply the values file with the chart used for this gateway release:
helm upgrade <release-name> <chart-name> -n <namespace> -f values.yamlParameters
See plugin common configurations (opens in Apache APISIX docs) for configuration options available to all plugins.
cache_strategy — string · optional · default: disk · since APISIX 3.17.0 · API7 Gateway 3.1.0
Valid values: disk or memory
Caching strategy. Cache on disk or in memory.
cache_zone — string · optional · default: disk_cache_one · since APISIX 3.17.0 · API7 Gateway 3.1.0
Cache zone used with the caching strategy. The value should match one of the cache zones defined in the configuration files and should correspond to the caching strategy. For example, when using the in-memory caching strategy, you should use an in-memory cache zone.
cache_ttl — integer · optional · default: 300 · since APISIX 3.17.0 · API7 Gateway 3.1.0
Valid values: greater than or equal to 1
Cache time to live (TTL) in seconds when caching in memory.
To adjust the TTL when caching on disk, update cache_ttl in the configuration files. Note that the TTL value is only used when the response headers Cache-Control and Expires are both absent.
consumer_isolation — boolean · optional · default: true · since APISIX 3.17.0 · API7 Gateway 3.9.13
If true, prepend the authenticated consumer identity to the effective cache key when the request resolves to an APISIX consumer or remote user. Arbitrary upstream credentials, such as a forwarded bearer token, are not used as the identity. If a route forwards user-specific credentials without using an APISIX authentication plugin, different users could receive the same cached response. Enable an APISIX authentication plugin or disable caching for that route. Available in API7 Enterprise from version 3.9.13 and APISIX from version 3.17.0.