Skip to content

Commit

Permalink
Merge pull request #12086 from craftcms/bugfix/11994-graphql-cache-hits
Browse files Browse the repository at this point in the history
Don't factor `$context` in to cache key
  • Loading branch information
brandonkelly authored Oct 18, 2022
2 parents 62cde9e + 2353e68 commit dbec5e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
- Element queries now support passing ambiguous column names (e.g. `dateCreated`) and field handles into `select()`. ([#11790](https://github.com/craftcms/cms/pull/11790), [#11800](https://github.com/craftcms/cms/pull/11800))
- `{% cache %}` tags now store any HTML registered with `{% html %}` tags. ([#11811](https://github.com/craftcms/cms/discussions/11811))
- `{% cache %}` tags and GraphQL query caches now get a max cache duration based on the fetched/referenced entries’ expiry dates. ([#8525](https://github.com/craftcms/cms/discussions/8525), [#11901](https://github.com/craftcms/cms/pull/11901))
- Improved GraphQL cache reliability. ([#11994](https://github.com/craftcms/cms/issues/11994), [#12086](https://github.com/craftcms/cms/pull/12086))
- Control panel `.twig` templates are now prioritized over `.html`. ([#11809](https://github.com/craftcms/cms/discussions/11809), [#11840](https://github.com/craftcms/cms/pull/11840))
- `craft\elements\db\ElementQuery::collect()` and `craft\base\Element::getEagerLoadedElements()` now return `craft\elements\ElementCollection` instances. ([#12113](https://github.com/craftcms/cms/discussions/12113))
- `craft\events\DraftEvent::$creatorId` is now nullable. ([#11904](https://github.com/craftcms/cms/issues/11904))
Expand Down
5 changes: 1 addition & 4 deletions src/services/Gql.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,6 @@ public function executeQuery(
$schema,
$event->query,
$event->rootValue,
$event->context,
$event->variables,
$event->operationName
);
Expand Down Expand Up @@ -1235,7 +1234,6 @@ public function prepareFieldDefinitions(array $fields, string $typeName): array
* @param GqlSchema $schema
* @param string $query
* @param mixed $rootValue
* @param mixed $context
* @param array|null $variables
* @param string|null $operationName
* @return string|null
Expand All @@ -1244,7 +1242,6 @@ private function _getCacheKey(
GqlSchema $schema,
string $query,
mixed $rootValue,
mixed $context,
?array $variables = null,
?string $operationName = null,
): ?string {
Expand All @@ -1271,7 +1268,7 @@ private function _getCacheKey(
'::' . $schema->uid .
'::' . md5($query) .
'::' . serialize($rootValue) .
'::' . serialize($context) .
'::' . Craft::$app->getInfo()->configVersion .
'::' . serialize($variables) .
($operationName ? "::$operationName" : '');
} catch (Throwable $e) {
Expand Down

0 comments on commit dbec5e6

Please sign in to comment.