@@ 244-254 (lines=11) @@ | ||
241 | * @return \Drupal\Core\Cache\CacheableMetadata |
|
242 | * The cache metadata collected from the schema's types. |
|
243 | */ |
|
244 | protected function extractSchemaCacheMetadata(AbstractSchema $schema) { |
|
245 | $metadata = new CacheableMetadata(); |
|
246 | $metadata->setCacheMaxAge(Cache::PERMANENT); |
|
247 | $metadata->addCacheTags(['graphql_schema']); |
|
248 | ||
249 | $metadata->addCacheableDependency($this->collectCacheMetadata($schema, function (TypeSystemPluginInterface $item) { |
|
250 | return $item->getSchemaCacheMetadata(); |
|
251 | })); |
|
252 | ||
253 | return $metadata; |
|
254 | } |
|
255 | ||
256 | /** |
|
257 | * Collects result cache metadata from all types registered with the schema. |
|
@@ 268-279 (lines=12) @@ | ||
265 | * @return \Drupal\Core\Cache\CacheableMetadata |
|
266 | * The cache metadata collected from the schema's types. |
|
267 | */ |
|
268 | protected function extractResponseCacheMetadata(AbstractSchema $schema) { |
|
269 | $metadata = new CacheableMetadata(); |
|
270 | $metadata->setCacheMaxAge(Cache::PERMANENT); |
|
271 | $metadata->addCacheTags(['graphql_response']); |
|
272 | $metadata->addCacheContexts(['gql']); |
|
273 | ||
274 | $metadata->addCacheableDependency($this->collectCacheMetadata($schema, function (TypeSystemPluginInterface $item) { |
|
275 | return $item->getResponseCacheMetadata(); |
|
276 | })); |
|
277 | ||
278 | return $metadata; |
|
279 | } |
|
280 | ||
281 | /** |
|
282 | * Recursively collects cache metadata from the generated schema. |