protected function Executor::cacheRead in GraphQL 8.4
Lookup cached results by contexts for this query.
Parameters
string $prefix:
Return value
\GraphQL\Executor\ExecutionResult|null
1 call to Executor::cacheRead()
- Executor::doExecuteCached in src/
GraphQL/ Execution/ Executor.php - Try to return cached results, otherwise resolve the query.
File
- src/
GraphQL/ Execution/ Executor.php, line 330
Class
- Executor
- Executes GraphQL queries with cache lookup.
Namespace
Drupal\graphql\GraphQL\ExecutionCode
protected function cacheRead($prefix) {
if ($cache = $this->cacheBackend
->get("contexts:{$prefix}")) {
$suffix = $this
->cacheSuffix($cache->data ?? []);
if ($cache = $this->cacheBackend
->get("result:{$prefix}:{$suffix}")) {
$result = new CacheableExecutionResult($cache->data['data'], [], $cache->data['extensions']);
$result
->addCacheableDependency($cache->data['metadata']);
return $result;
}
}
return NULL;
}