On this page
function views_invalidate_cache
views_invalidate_cache()
Invalidate the views cache, forcing a rebuild on the next grab of table data.
File
- core/modules/views/views.module, line 461
- Primarily Drupal hooks and global API functions to manipulate views.
Code
function views_invalidate_cache() {
// Set the menu as needed to be rebuilt.
\Drupal::service('router.builder')->setRebuildNeeded();
$module_handler = \Drupal::moduleHandler();
// Reset the RouteSubscriber from views.
\Drupal::getContainer()->get('views.route_subscriber')->reset();
// Invalidate the block cache to update views block derivatives.
if ($module_handler->moduleExists('block')) {
\Drupal::service('plugin.manager.block')->clearCachedDefinitions();
}
// Allow modules to respond to the Views cache being cleared.
$module_handler->invokeAll('views_invalidate_cache');
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!views!views.module/function/views_invalidate_cache/8.1.x