Skip to main content

Documentation Portal

Cache
image61.png

Caching is used to avoid overloading the Global‑e APIs with too many duplicate requests.

Global‑e sends back data with cache-specific information in the headers of their responses and requires that you (the merchant) build a cache into your systems when connecting to the Global‑e APIs.

Request Flow

When a request is made to the integration service, the following steps take place:

  1. Based on the call parameters, the cache is searched for matching data.

  2. If matching data is found:

    1. The data’s last update time is compared with the current time to create a stale period.

    2. If this stale period is shorter than the cache expiry period, the cached data is returned with the status UPTODATE.

    3. If this stale period is the same as or longer than the cache expiry period:

      1. A request is made to the Global‑e API.

      2. If the request is successful:

        • The resulting data is used to update the cache.

        • The resulting data is returned with the status UPTODATE.

      3. If the request is not successful, the OLD data is returned with the status STALE.

  3. If matching data is NOT found:

    1. A request is made to the Global‑e API.

    2. If the request is successful:

      • The resulting data is used to update the cache.

      • The resulting data is returned with the status UPTODATE.

    3. If the request is not successful:

      • An exception is thrown: GlobaleIntegrationServiceException.

Global‑e provides flow diagrams and details about which endpoints/objects to cache. A snippet of front-end activities is provided as an example below.

Example of the recommended Global‑e cache behaviour flow:

image62.png
Global‑e Headers

All API method calls may optionally return the following headers:

  • Cache-Control: public

  • max-age=x

These headers indicate the recommended client-side caching interval for the data returned by the respective call unless otherwise stated in a specific class or method definition.

There is functionality to parse those headers into a usable object.

Cache Persistence

Global‑e relies on the SAP Hybris persistence for caching API data. Global‑e creates new cache types in SAP Hybris with the common ancestor GlobaleBaseCache to store the cache. Cache age is controlled by Global‑e.

Data Structure and Database Indexes
image63.png