QuestionQ2
Content, CMS, and StorefrontAn Architect on a headless Adobe Commerce project creates a new customer attribute named my_attribute. Based on the customer’s attribute value, a plugin modifies the results of GraphQL queries. The frontend application communicates with Adobe Commerce through Varnish by Fastly, which already caches the queries that will be modified. The Adobe Commerce Fastly extension is installed, and no other changes are made to the application.
Which steps should the Architect take to ensure that Varnish’s vcl_hash function also takes the newly created attribute into account?
- A Create a new class inheriting from Magento\Framework\GraphQl\Query\Resolver\IdentityInterface and returning the value of my_attribute from the getIdentities function. Then specify a @cache(cacheIdentity: Path\To\IdentityClass) directive for each GraphQL query to include the newly created IdentityClass to each query that adds the cache tags for each customer.
- B Create a new class inheriting from Magento\GraphQlCache\Model\CacheId\CacheIdFactorProviderInterface and returning the value of my_attribute from the getFactorValue function and my_attribute from getFactorName function. Then add this class through DI to the IdFactorProviders array of Magento\GraphQlCache\Model\CacheID\CacheIdCalculator.
- C Create a new class inheriting from Magento\Customer\CustomerData\SectionSourceInterface and returning the value of my_attribute from the getSectionData function. Then add this class through DI to the sectionSourceMap array of Magento\Customer\CustomerData\SectionPoolInterface.
Community Discussion