QuestionQ22

VerifiedTroubleshoot infrastructure and configuration issues

An Architect on a headless Adobe Commerce project creates a customer attribute named my_attribute. GraphQI query results are modified through a plugin according to the customer's attribute value. The frontend application communicates with Adobe Commerce via Varnish by Fastly, which already caches the queries that will be modified. The Adobe Commerce Fastly extension is installed, and no other application changes are made.

What steps should the Architect take to ensure that Varnish's vcl_hash function also takes the newly created attribute into account?

Explanation

Adobe Commerce builds X-Magento-Cache-Id from context-specific factors, and Fastly/Varnish use that cache ID to distinguish cached GraphQL results. A custom CacheIdFactorProviderInterface implementation that returns my_attribute as a named factor, registered in Magento\GraphQlCache\Model\CacheId\CacheIdCalculator through the idFactorProviders DI argument, adds the attribute to that cache-key calculation. IdentityInterface provides cache tags for invalidation rather than cache-key segmentation, while customer-data sections support private customer data rather than GraphQL response caching.

Learn more

Community Discussion

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