Parameter | Required | Description |
Cache parameter | Yes | The cached content can be distinguished by the parameter or the combination of multiple parameters. Supported parameter locations include Header, Path, and Query. |
Request method | Yes | You can select multiple methods. Valid values: GET, POST, PUT, DELETE, HEAD. |
Cache status code | Yes | Only responses with a status code set in the cache plugin will be cached. You can separate multiple status codes with commas. |
Cache-Control | Yes | It specifies whether to use the `Cache-Control` request header to affect the cache policy. It is disabled by default. |
Cache duration | Yes | It is the cache validity period, which is a positive integer between 0 and 3600. |
{"cache_key_params": [{ // Parameter for distinguishing between cached responses. The source of `parameter` is the parameter defined in the API, and the valid values of `position` are `header`, `query`, and `path`"parameter": "param1","position": "header"}, {"parameter": "param2","position": "query"}, {"parameter": "param3","position": "path"}],"cacheable_methods": ["GET", "POST"], // HTTP methods of requests whose responses can be cached. Valid values: GET, POST, PUT, DELETE, HEAD"cacheable_response_codes": [200, 301, 404], // HTTP return codes of responses that can be cached"cache_control": false, // Whether to enable the `Cache-Control` syntax in the HTTP standard. After it is enabled, `Cache-Control` of requests and responses will take effect, and the custom TTL will be ignored"ttl": 300 // Custom cache validity period, which will take effect if `cache_control` is `false`. Value range: [1,3600]}
Cache-Control
is enabled, the gateway will process the cache according to the convention in the Cache-Control
request/response header. In this case, if the gateway cannot get the Cache-Control
header, the response will be cached by default, and the cache duration
field configured in the plugin will be used as the cache validity period.
Was this page helpful?