From f9c08589e53d39f1097d5207625c98245ccbd10d Mon Sep 17 00:00:00 2001 From: Oleksandr Melnyk Date: Thu, 10 Dec 2020 16:54:24 +0200 Subject: [PATCH] magneto/magento2ce #31115: need to make Get requests with a Preview-Version header non-cacheable - added method to disable caching for a graphql query field --- .../Magento/Framework/GraphQl/Config/Element/Field.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/internal/Magento/Framework/GraphQl/Config/Element/Field.php b/lib/internal/Magento/Framework/GraphQl/Config/Element/Field.php index 0b1b8ae3da31b..af4a3f0dd8ba0 100644 --- a/lib/internal/Magento/Framework/GraphQl/Config/Element/Field.php +++ b/lib/internal/Magento/Framework/GraphQl/Config/Element/Field.php @@ -183,4 +183,12 @@ public function getDeprecated() : array { return $this->deprecated; } + + /** + * Disable caching for the field + */ + public function disableCaching(): void + { + $this->cache = []; + } }