protected function ViewsDisplayCachingTest::getResultsCache in Search API 8
Returns the current query result cache of the given view.
Parameters
\Drupal\views\ViewExecutable $view: The view for which to return the query result cache.
Return value
false|object The cache object, or FALSE if the query cache is not populated.
2 calls to ViewsDisplayCachingTest::getResultsCache()
- ViewsDisplayCachingTest::assertViewsResultsCacheNotPopulated in tests/
src/ Kernel/ Views/ ViewsDisplayCachingTest.php - Checks that the query result of the given view is not currently cached.
- ViewsDisplayCachingTest::assertViewsResultsCachePopulated in tests/
src/ Kernel/ Views/ ViewsDisplayCachingTest.php - Checks that the query result of the given view is currently cached.
File
- tests/
src/ Kernel/ Views/ ViewsDisplayCachingTest.php, line 177
Class
- ViewsDisplayCachingTest
- Tests the Search API caching plugins for Views.
Namespace
Drupal\Tests\search_api\Kernel\ViewsCode
protected function getResultsCache(ViewExecutable $view) {
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache_plugin */
$cache_plugin = $view->display_handler
->getPlugin('cache');
// Ensure that the views query is built.
$view
->build();
return $this->cache
->get($cache_plugin
->generateResultsKey());
}