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');
}
doc_Drupal
2016-10-29 09:55:38
Comments
Leave a Comment

Please login to continue.