QuestionQ45

VerifiedContent, CMS, and Storefront

An existing Adobe Commerce website is being moved to a headless implementation.

The current website includes an “All Brands” page and separate pages for every brand. All pages related to brands are cached in Varnish with tags, in the same way as products and categories.

Two new GraphQL queries have been created to expose this information to the frontend for the new headless implementation:

Question Image

During testing, the queries occasionally return stale information. How should this issue be resolved while preserving performance?

Explanation

A cacheable custom GraphQL query needs an Identity class specified through @cache(cacheIdentity: ...). The Identity class returns cache tags for the relevant entities, enabling invalidation of Varnish-cached GraphQL responses when a brand or associated product changes. This retains caching performance while preventing stale brand data.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!