Caching third-party API data with Hydrogen and Oxygen

The API client built into Hydrogen includes caching strategies for Storefront API data. However, if you make fetch requests to third-party APIs in your Hydrogen app, then the following behavior occurs:

  • HTTP GET responses are cached according to their response headers.
  • POST requests aren't cached.

There are several ways to manage caching of third-party data with Hydrogen and Oxygen:

  1. Hydrogen’s built-in withCache utility (recommended)
  2. Creating custom abstractions
  3. Caching content manually