Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Parameter Name

Description

Default Value

Label

Required. The name for the API policy.

HTTP Respone Cache

When this policy should be applied

An expression-enabled field that determines the condition to be fulfilled for the API policy to execute.

For example, if the value in this field is request.method == "POST", the API policy is executed only if the request method is a POST.

N/A

Cache Interval

The time period of the current cache before it is evicted.

1

Time Unit

The time unit for the Cache Interval value.

Hour

Use HTTP Request Headers to Create Cache Keys

Enables use of all header values as part of the generated cache key.

Unselected

Use HTTP Request Query Parameter to Create Cache Keys

Enables use of all query parameter values as part of the generated cache key.

Unselected

Status

Specifies whether the API policy is enabled or disabled. 

Enabled

Best Practices

  • Do not use any headers and query string parameters, like a timestamp, as part of your cache key, or it will never result in a fulfilled request. You can optionally remove those headers using the Request Transformer policy. Or, avoid headers query string parameters as part of the cache key and only as needed when a unique value is present per request.

  • To invalidate cached data, use the Invalidate Response Cache API. The Invalidate Response Cache API enables you to keep cached data up to date with the latest changes. You can define caching rules for the specific API endpoint, specifying parameters such as cache duration, cache key generation, and cache storage. The cache invalidation mechanism monitors changes in the data source and updates the cache as configured to ensure data consistency.

Example

To demonstrate the advantage of caching reoccurring and/or static HTTP responses, the following proxy endpoint GET request is provided as an example.

...