Skip to content

Commit cfb2637

Browse files
committed
Moving cache to getCacheDependencies.
1 parent 8034b38 commit cfb2637

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Plugin/GraphQL/Fields/SearchAPISearch.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,20 @@ public function resolveValues($value, array $args, ResolveContext $context, Reso
102102
// Set response type.
103103
$search_response['type'] = 'SearchAPIResult';
104104

105-
// Adding Caching.
105+
yield $search_response;
106+
107+
}
108+
109+
/**
110+
* {@inheritdoc}
111+
*/
112+
protected function getCacheDependencies(array $result, $value, array $args, ResolveContext $context, ResolveInfo $info) {
113+
106114
$metadata = new CacheableMetadata();
107115

108116
$metadata->addCacheTags(['search_api_list:' . $this->index->id()]);
109117

110-
yield new CacheableValue($search_response, [$metadata]);
111-
118+
return [$metadata];
112119
}
113120

114121
/**

0 commit comments

Comments
 (0)