Response Caching
In case of a request to the source for the same data, we have implemented a response caching mechanism wherein the response is cached after the first API call for a specified duration. This ensures that data is readily available to the users when required.
The cache expires after 24 hours, meaning that the cached response will be valid for one day before a new request to the source is required. Please note that this is an eventually consistent system, which means that the cache may take some time to propagate across servers and the response might not be cached immediately after the first successful hit.
There will be no wallet charges if you receive a cached response.
X-Accept-Cache Header
Sandbox API now supports the X-Accept-Cache
header, giving users control over whether they want to retrieve cached responses or fresh data from the origin.
To use this feature, include the X-Accept-Cache
header in your request with one of the following values:
- true: The API will return the cached response if available.
- false: The API will bypass the cache and return the latest data from the origin.
By default, if the X-Accept-Cache header is not included in the request, the API will return the response from the origin.
X-Cache Header
The response will include a X-Cache
header, which will provide caching status of the API response. Here are the possible values
X-Cache value | Description |
---|---|
Hit from Cloudfront | This a Cached Response |
Miss from Cloudfront | This is a fresh response that has now been cached |
Error from Cloudfront | Will appear for a non 2XX code, wherein the cache was not hit and the response was not cached |
Updated 4 months ago