How Caching Works
- Cache Duration: Data retrieved via the API is cached for a maximum of 5 minutes.
- Refreshing Cached Data: When new data is fetched (e.g., retrieving a later page of results), the cache is updated and the 5-minute lifetime is reset.
- Scope: Caching applies to all GET requests, including paginated responses. The cache may contain more items than the page requested to reduce the number of calls made to the source system. For connectors that support bigger page sizes than the ones served by Chift, optimizations are made to reduce the number of requests. This can lead to multiple pages worth of data being cached from the first page requested. When non-cached data is requested, already cached data has its lifetime reset to ensure consistency with the newly fetched data.
Forcing a Refresh
In cases where fresh data is required immediately—such as after creating a new object—you can bypass the cache using thex-chift-force-refresh HTTP header:
A typical workflow using this header looks like this:
- Get Journals (without header)
- Create Journals
- Get Journals (with
x-chift-force-refreshheader)
Important Considerations
- The
x-chift-force-refreshheader should only be used in specific scenarios, such as retrieving data immediately after creating a new object. - Using this header indiscriminately can impact API performance. Chift reserves the right to temporarily block excessive calls that misuse this header.
- In general, relying on cached responses is recommended to ensure consistent performance and minimize load on both Chift and connected systems.