Updated on 2025-08-15 GMT+08:00

ProxyCacheContent

Table 1 ProxyCacheContent

Parameter

Mandatory

Type

Description

cache_key

No

PluginProxyCacheKey object

The configuration parameter is used as the value of the cache proxy key. cache_key is mandatory. Therefore, at least one of the system_params, parameters, and headers parameters needs to be configured.

cache_http_status_and_ttl

No

Array of PluginProxyCacheHttpStatusTtl objects

HTTP status codes that can be cached and the cache duration.

client_cache_control

No

PluginProxyCacheClientCacheControl object

Allows the client to use the Cache-Control header to affect the cache policy.

cacheable_headers

No

Array of strings

Backend headers that can be cached. By default, only the Content-Type, Content-Encoding, and Content-Language headers are cached. A maximum of 20 parameters are supported. The value is a string of 1 to 64 characters. System response headers (such as x-apig-* and x-request-id) added by APIG cannot be added.

Table 2 PluginProxyCacheKey

Parameter

Mandatory

Type

Description

system_params

No

Array of strings

The built-in system parameter of the gateway is used as the value of the cache proxy key.

The gateway parameters are as follows:

  • $context.sourceIp: source IP address of the API caller
  • $context.stage: deployment environment in which the API is called
  • $context.apiId: API ID
  • $context.appId: ID of the app used by the API caller
  • $context.requestId: request ID generated when the API is called.
  • $context.serverAddr: address of the gateway server
  • $context.serverName: name of the gateway server
  • $context.handleTime: processing time of the API request
  • $context.providerAppId: ID of the app used by the API owner (not supported)
  • $context.apiName: API name, which can be used only after the API is published
  • $context.appName: name of the credential used for calling the API

parameters

No

Array of strings

The request query parameter is used as the value of the cache proxy key.

headers

No

Array of strings

The request header is used as the value of the cache proxy key.

Table 3 PluginProxyCacheHttpStatusTtl

Parameter

Mandatory

Type

Description

http_status

No

Array of integers

Determines whether to cache content based on the HTTP response code.

ttl

No

Integer

Cache expiration time, in seconds.

Table 4 PluginProxyCacheClientCacheControl

Parameter

Mandatory

Type

Description

mode

No

String

Mode in which the client is allowed to affect the cache policy. Options:

  • off: rejects all requests.
  • all: allows all requests.
  • apps: The value of App ID can be in the datas list.

datas

No

Array of strings

If mode is set to apps, values of App ID in the following table are allowed.