1

My Magento 2.4 isn't caching requests I use many times, like storeConfig via PWA Studio.

My request header:

x-cache-hits: 0

How could I cache this kind of request to optimize the speed of my page loads?

1 Answer 1

2

The storeConfig cache will be released in the lasted version of Magento 2.4.7, so you will be able to update it to have it.

About other requests, you need to create a Resolver, then specified it in your GraphQL schema.

@doc(description: "The store config query") @cache(cacheIdentity: "Magento\\StoreGraphQl\\Model\\Resolver\\Store\\Identity")

You can see an example of it in the Magento 2 Core storeConfig cache implementation.

Don't forget to make sure you configured the Caching with Varnish or Caching with Fastly steps too.

2
  • Till now Magento 2.4.7 is not released yet. I think you have to correct the magento version in your answer Mar 30 at 15:11
  • It will be included in the 2.4.7, thank you, I updated the comment in my answer. Mar 30 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.