diff --git a/core/includes/module.inc b/core/includes/module.inc index 642c32c..f65f0b8 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -60,16 +60,6 @@ function system_list_reset() { drupal_static_reset('system_list'); drupal_static_reset('system_rebuild_module_data'); \Drupal::cache('bootstrap')->delete('system_list'); - - // Clear the library info cache. - // Libraries may be provided by all extension types, and may be altered by any - // other extensions (types) due to the nature of - // \Drupal\Core\Extension\ModuleHandler::alter() and the fact that profiles - // are recorded and handled as modules. - // @todo Trigger an event upon module install/uninstall and theme - // enable/disable, and move this into an event subscriber. - // @see https://drupal.org/node/2206347 - Cache::invalidateTags(['config:core.extension']); } /** diff --git a/core/modules/views/src/Plugin/ViewsHandlerManager.php b/core/modules/views/src/Plugin/ViewsHandlerManager.php index b6aa487..5244147 100644 --- a/core/modules/views/src/Plugin/ViewsHandlerManager.php +++ b/core/modules/views/src/Plugin/ViewsHandlerManager.php @@ -59,7 +59,7 @@ public function __construct($handler_type, \Traversable $namespaces, ViewsData $ } parent::__construct("Plugin/views/$handler_type", $namespaces, $module_handler, $plugin_interface, $plugin_definition_annotation_name); - $this->setCacheBackend($cache_backend, "views:$handler_type", array('config:core.extension', 'extension:views')); + $this->setCacheBackend($cache_backend, "views:$handler_type"); $this->alterInfo('views_plugins_' . $handler_type); $this->viewsData = $views_data; diff --git a/core/modules/views/src/Plugin/ViewsPluginManager.php b/core/modules/views/src/Plugin/ViewsPluginManager.php index efb9061..97d41c7 100644 --- a/core/modules/views/src/Plugin/ViewsPluginManager.php +++ b/core/modules/views/src/Plugin/ViewsPluginManager.php @@ -43,7 +43,7 @@ public function __construct($type, \Traversable $namespaces, CacheBackendInterfa ); $this->alterInfo('views_plugins_' . $type); - $this->setCacheBackend($cache_backend, "views:$type", array('config:core.extension', 'extension:views')); + $this->setCacheBackend($cache_backend, "views:$type"); } } diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 6c3a819..39e1037 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -186,7 +186,7 @@ public function initDisplay(ViewExecutable $view, array &$display, array &$optio } else { $this->unpackOptions($this->options, $options); - \Drupal::cache('data')->set($cid, $this->options, Cache::PERMANENT, Cache::mergeTags(array('config:core.extension', 'extension:views'), $this->view->storage->getCacheTags())); + \Drupal::cache('data')->set($cid, $this->options, Cache::PERMANENT, $this->view->storage->getCacheTags()); } static::$unpackOptions[$cid] = $this->options; } diff --git a/core/modules/views/src/Tests/DefaultViewsTest.php b/core/modules/views/src/Tests/DefaultViewsTest.php index 27f0d8b..1d11868 100644 --- a/core/modules/views/src/Tests/DefaultViewsTest.php +++ b/core/modules/views/src/Tests/DefaultViewsTest.php @@ -86,8 +86,6 @@ protected function setUp() { $this->addDefaultCommentField('node', 'page'); - $this->container->get('views.views_data')->clear(); - for ($i = 0; $i <= 10; $i++) { $user = $this->drupalCreateUser(); $term = $this->createTerm($vocabulary); diff --git a/core/modules/views/src/Tests/Entity/FieldEntityTest.php b/core/modules/views/src/Tests/Entity/FieldEntityTest.php index acc7680..37e27c0 100644 --- a/core/modules/views/src/Tests/Entity/FieldEntityTest.php +++ b/core/modules/views/src/Tests/Entity/FieldEntityTest.php @@ -45,8 +45,6 @@ public function testGetEntity() { $account->save(); $this->drupalCreateContentType(array('type' => 'page')); $this->addDefaultCommentField('node', 'page'); - // Force a flush of the in-memory storage. - $this->container->get('views.views_data')->clear(); $node = entity_create('node', array('uid' => $account->id(), 'type' => 'page')); $node->save(); diff --git a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php index 44930ed..cee903e 100644 --- a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php +++ b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php @@ -81,8 +81,6 @@ public function testCalculateDependencies() { 'label' => $this->randomMachineName() . '_body', 'settings' => array('display_summary' => TRUE), ))->save(); - // Force a flush of the in-memory storage. - $this->container->get('views.views_data')->clear(); $expected = []; $expected['test_field_get_entity'] = [ diff --git a/core/modules/views/src/Tests/FieldApiDataTest.php b/core/modules/views/src/Tests/FieldApiDataTest.php index 31c73ad..e0630d1 100644 --- a/core/modules/views/src/Tests/FieldApiDataTest.php +++ b/core/modules/views/src/Tests/FieldApiDataTest.php @@ -36,8 +36,6 @@ protected function setUp() { ); $nodes[] = $this->drupalCreateNode($edit); } - - $this->container->get('views.views_data')->clear(); } /** diff --git a/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php b/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php index bcccbdc..a5f18d2 100644 --- a/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php +++ b/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php @@ -61,8 +61,6 @@ protected function setUp() { 'bundle' => $node_type->id(), ); entity_create('field_config', $field)->save(); - - $this->container->get('views.views_data')->clear(); } /** diff --git a/core/modules/views/src/Tests/ViewTestBase.php b/core/modules/views/src/Tests/ViewTestBase.php index 042c5ce..d0bc989 100644 --- a/core/modules/views/src/Tests/ViewTestBase.php +++ b/core/modules/views/src/Tests/ViewTestBase.php @@ -34,11 +34,6 @@ protected function setUp($import_test_views = TRUE) { parent::setUp(); - - // Ensure that the plugin definitions are cleared. - foreach (ViewExecutable::getPluginTypes() as $plugin_type) { - $this->container->get("plugin.manager.views.$plugin_type")->clearCachedDefinitions(); - } if ($import_test_views) { ViewTestData::createTestViews(get_class($this), array('views_test_config')); } diff --git a/core/modules/views/src/ViewsData.php b/core/modules/views/src/ViewsData.php index 81469e7..2c8fe23 100644 --- a/core/modules/views/src/ViewsData.php +++ b/core/modules/views/src/ViewsData.php @@ -200,7 +200,7 @@ protected function cacheGet($cid) { * The data that will be cached. */ protected function cacheSet($cid, $data) { - return $this->cacheBackend->set($this->prepareCid($cid), $data, Cache::PERMANENT, array('views_data', 'config:core.extension', 'extension:views')); + return $this->cacheBackend->set($this->prepareCid($cid), $data, Cache::PERMANENT, array('views_data', 'config:core.extension')); } /** diff --git a/core/modules/views/views.module b/core/modules/views/views.module index d8516be..3197622 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -462,33 +462,27 @@ function views_add_contextual_links(&$render_element, $location, ViewExecutable * Implements hook_ENTITY_TYPE_create() for 'field_config'. */ function views_field_config_create(FieldConfigInterface $field) { - // @todo: Is this necessary? Use cache tags to only delete Views' cache data? - \Drupal::cache('discovery')->deleteAll(); + Views::viewsData()->clear(); } /** * Implements hook_ENTITY_TYPE_update() for 'field_config'. */ function views_field_config_update(FieldConfigInterface $field) { - Cache::invalidateTags(['extension:views']); - \Drupal::cache('render')->deleteAll(); + Views::viewsData()->clear(); } /** * Implements hook_ENTITY_TYPE_delete() for 'field_config'. */ function views_field_config_delete(FieldConfigInterface $field) { - Cache::invalidateTags(['extension:views']); - \Drupal::cache('render')->deleteAll(); + Views::viewsData()->clear(); } /** * Invalidate the views cache, forcing a rebuild on the next grab of table data. */ function views_invalidate_cache() { - // Clear Views' info cache entries. - Cache::invalidateTags(['extension:views']); - // Set the menu as needed to be rebuilt. \Drupal::service('router.builder_indicator')->setRebuildNeeded();