Skip to end of banner
Go to start of banner

HTTP Response Cache

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

On this page

Overview

Use this policy to save time when network is congested and proxy API response is delayed. An incoming HTTP request to one of your Proxy endpoints returns the cached response after a specified time period.

In the policy settings, you specify the cache key parameters that HTTP requests map to and set the cache response time and refresh interval.

Because API Versions use endpoints generated in the SnapLogic IIP, the HTTP Response Cache policy supports Proxy endpoints only by design. In the UI, the API Policy Manager menus API and Version Details tabs do not display this policy.

Policy Execution Order

This policy executes after authentication and traffic shaping policies.

Architecture

This policy uses Google Guava cache, which offers a map to send responses. The cache must be enabled through feature flags on the Snaplex.

  • Protocol

  • Host 

  • PAth 

  • Method

Headers/Query params supported

Hash Key SChe1 algorithm

Each key-value pair in the Response Cache Map will be:

{
  policy_instance_id: Google Guava Cache,
  ...
}


Each Google Guava Cache has the key-value pairs:

{
  [ Hash Hex of params specified by policy ]: Cached HTTP Response
  ...
}


Each Cached HTTP Response contains the following information:

  • Original HTTP Response Object for preserving the flow of handling HTTP responses in the Gateway Resource.

    • byte[] of the response content to preserve the stream that cannot be rewound.

Expired caches cannot be accessed and new entries overwrite any existing ones.

  • policy version to determine if the policy has been updated since the last save. An update to the policy will direct the flow to acquire a new HTTP response and overwrite the existing one.

Limitations

We do limit the response cache to have a response less than the MAX_CACHE_BYTES which is a feature flag default to a value of 90000000 bytes which is equivalent to 85.83 MB (edited)

Settings

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 refreshed.

1

Time Unit

The time unit for the Cache Interval value.

Hour

Use HTTP Request Headers to Create Cache Keys

Enables the use of specific headers to identify a cache.

Unselected

Use HTTP Request Query Parameter to Create Cache Keys

Enables the use of query parameters to identify a cache.

Unselected

Status

Specifies whether the API policy is enabled or disabled. 

Enabled

  • No labels