We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3841ce8 commit a436bf9Copy full SHA for a436bf9
src/GraphQL/Execution/Executor.php
@@ -301,10 +301,17 @@ protected function cachePrefix() {
301
$extensions = $this->context->getOperation()->extensions ?: [];
302
ksort($extensions);
303
304
+ // By firing the operation event before executing the operation and before
305
+ // reading from the cache different contexts might be set to control the
306
+ // caching and make it possible to cache e.g. by country.
307
+ $contexts = $this->context->getCacheContexts();
308
+ $keys = $this->contextsManager->convertTokensToKeys($contexts)->getKeys();
309
+
310
$hash = hash('sha256', serialize([
311
'query' => DocumentSerializer::serializeDocument($this->document),
312
'variables' => $variables,
313
'extensions' => $extensions,
314
+ 'keys' => $keys,
315
]));
316
317
return $hash;
0 commit comments