Skip to content

Commit c170097

Browse files
committed
B2B-2451: Implement GraphQL Resolver Cache for CMS Page Type
1 parent bb8659d commit c170097

File tree

1 file changed

+10
-6
lines changed
  • app/code/Magento/GraphQlCache/Model/Plugin/Query/Resolver/Result

1 file changed

+10
-6
lines changed

app/code/Magento/GraphQlCache/Model/Plugin/Query/Resolver/Result/Cache.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,16 @@ public function aroundResolve(
128128

129129
$resolvedValue = $proceed($field, $context, $info, $value, $args);
130130

131-
$this->graphQlResolverCache->save(
132-
$this->serializer->serialize($resolvedValue),
133-
$cacheIdentityString,
134-
$identityProvider->getIdentities($resolvedValue),
135-
false, // use default lifetime directive
136-
);
131+
$identities = $identityProvider->getIdentities($resolvedValue);
132+
133+
if (count($identities)) {
134+
$this->graphQlResolverCache->save(
135+
$this->serializer->serialize($resolvedValue),
136+
$cacheIdentityString,
137+
$identities,
138+
false, // use default lifetime directive
139+
);
140+
}
137141

138142
return $resolvedValue;
139143
}

0 commit comments

Comments
 (0)