QuestionQ19
Troubleshoot infrastructure and configuration issuesAn existing Adobe Commerce website is being moved to a headless implementation.
The existing site includes an All Brands page and separate pages for every brand. All brand-related pages 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:

During testing, the queries occasionally return stale information. How should this issue be resolved while preserving performance?
- A Specify a $cache(cacheable: false) directive for each GraphQL query, making sure that the data returned is not cached, and is up to date
- B Specify a @cache(cacheIdentity: Path\To\IdentityClass) directive for each GraphQL query, corresponding to a class that adds cache tags for relevant brands and associated products
- C Each GraphQL query’s resolver class should inject \Magento\GraphQlCache\Model\CacheableQuery and call setCacheValidity(true) on it as part of the resolver’s resolve function
Community Discussion