I just applied the GraphQL cache in my PWA Studio custom queries.

I'm not sure if the cache is working, should the x-cache-hits be enough to validate?

How does it work behind the scenes?

1 Answer 1


Yes, the x-cache-hits is a very accurate method to check it, with the pragma, x-cache, and x-magento-cache-id.

As you can see below, if you have the cache HIT and not 0 or MISS, you're good.

Magento 2 graphql cache headers

Another way to validate it is by checking the answer time. Usually, the queries cached are ~10 times faster than the non-cached requests. This query below has 19.30ms spent waiting for server response, my requests without full page cache, spend ~200ms.

Magento 2 GraphQL query cached

How does it work?

Varnish will take care of the cache if don't use Fastly or another CDN. The VCL file you adjusted will allow it, and Magento will add the ideal headers to make it possible via the code below.


Using the development mode you will be able to see the x-magento-tags, which will be managed by your full page cache system.

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.