Cert++
Close

OCAPI response caching behavior and configuration

Key Takeaway

The Cache-Control max-age value is the time left on the cached entry, not the configured cache_time. For a request with expansions, the entry starts from the shortest cache_time among the documents it contains.

OCAPI response caching stores Shop API and Meta API response documents in a B2C Commerce application-tier cache, so repeated requests can skip the database. For the Shop API, you set how long each resource stays cached in Business Manager. The API also reports the remaining cache time in a standard Cache-Control header, so client apps and proxies can cache responses too. When you connect an external system, these rules decide how fresh its data is and how much work its calls put on the application tier.

Which OCAPI requests are cached

Whether a request is cached depends on the API:

  • Shop API: most requests are cached, for a time you set per resource.
  • Meta API: resources are always cached for one day. You can't configure that time.
  • Data API: requests are never cached.

Every Data API call costs real-time application-tier work, so keep Data API calls to a minimum.

OCAPI has its own cache in the application tier. Because the web tier does not cache OCAPI requests, every OCAPI request pays the same application-tier overhead as an uncached storefront request, even on a cache hit. As a result, OCAPI requests are more expensive than storefront requests that the web tier caches.

OCAPI caching works only when "Site Page Caching" is enabled in Business Manager.

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Given a business requirement, use OCAPI Shop and Data APIs to enable interoperability with an external system

0/10

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other B2C Commerce Developer studiers. 796 members and growing.