function views_invalidate_cache

Invalidate the views cache, forcing a rebuild on the next grab of table data.

5 calls to views_invalidate_cache()
AdvancedSettingsForm::cacheSubmit in drupal/core/modules/views_ui/lib/Drupal/views_ui/Form/AdvancedSettingsForm.php
Submission handler to clear the Views cache.
ExposedFormTest::testRenameResetButton in drupal/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php
Tests, whether and how the reset button can be renamed.
SettingsTest::testEditUI in drupal/core/modules/views_ui/lib/Drupal/views_ui/Tests/SettingsTest.php
Tests the settings for the edit ui.
ViewStorageController::postSave in drupal/core/modules/views/lib/Drupal/views/ViewStorageController.php
Overrides Drupal\config\ConfigStorageController::postSave().
views_menu in drupal/core/modules/views/views.module
Implement hook_menu().
1 string reference to 'views_invalidate_cache'
views_hook_info in drupal/core/modules/views/views.module
Implements hook_hook_info().

File

drupal/core/modules/views/views.module, line 673
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_invalidate_cache() {

  // Clear the views cache.
  cache('views_info')
    ->deleteAll();

  // Clear the page and block cache.
  Cache::deleteTags(array(
    'content' => TRUE,
  ));

  // Set the menu as needed to be rebuilt.
  Drupal::state()
    ->set('menu_rebuild_needed', TRUE);
  $module_handler = Drupal::moduleHandler();

  // Set the router to be rebuild.
  // @todo Figure out why the cache rebuild is trigged but the route table
  //   does not exist yet.
  if (db_table_exists('router')) {
    Drupal::service('router.builder')
      ->rebuild();
  }

  // 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');
}