diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 559e437..d0432dd 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -2481,7 +2481,7 @@ function menu_get_active_title() { * Clears the cached cached data for a single named menu. */ function menu_cache_clear($menu_name = 'tools') { - cache('menu')->deleteTags(array('menu' => $menu_name)); + Cache::deleteTags(array('menu' => $menu_name)); // Also clear the menu system static caches. menu_reset_static_cache(); } diff --git a/core/lib/Drupal/Core/Cache/CacheCollector.php b/core/lib/Drupal/Core/Cache/CacheCollector.php index 21d5487..aa1fff2 100644 --- a/core/lib/Drupal/Core/Cache/CacheCollector.php +++ b/core/lib/Drupal/Core/Cache/CacheCollector.php @@ -268,7 +268,7 @@ public function reset() { public function clear() { $this->reset(); if ($this->tags) { - $this->cache->deleteTags($this->tags); + Cache::deleteTags($this->tags); } else { $this->cache->delete($this->cid); diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 9185c32..847042c 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -10,6 +10,7 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Component\Utility\NestedArray; +use Drupal\Core\Cache\Cache; use Drupal\Core\Field\FieldDefinition; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -404,7 +405,7 @@ public function getFieldDefinitionsByConstraints($entity_type, array $constraint public function clearCachedFieldDefinitions() { unset($this->entityFieldInfo); unset($this->fieldDefinitions); - $this->cache->deleteTags(array('entity_field_info' => TRUE)); + Cache::deleteTags(array('entity_field_info' => TRUE)); } /** diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index 6442577..16afd6e 100644 --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -7,6 +7,7 @@ namespace Drupal\Core\Entity; +use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManagerInterface; @@ -260,10 +261,10 @@ public function resetCache(array $entities = NULL) { $tags[$this->entityType][$id] = $id; $tags[$this->entityType . '_view_' . $entity->bundle()] = TRUE; } - \Drupal::cache($this->cacheBin)->deleteTags($tags); + Cache::deleteTags($tags); } else { - \Drupal::cache($this->cacheBin)->deleteTags(array($this->entityType . '_view' => TRUE)); + Cache::deleteTags(array($this->entityType . '_view' => TRUE)); } } diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index fbd42c5..c25dcd9 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Extension; use Drupal\Component\Utility\String; +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\ConfigInstallerInterface; @@ -465,7 +466,7 @@ protected function resetSystem() { // @todo It feels wrong to have the requirement to clear the local tasks // cache here. - $this->cacheBackend->deleteTags(array('local_task' => 1)); + Cache::deleteTags(array('local_task' => 1)); $this->themeRegistryRebuild(); } diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php index 712c5ee..3264735 100644 --- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Plugin; use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface; +use Drupal\Core\Cache\Cache; use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator; use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\PluginManagerInterface; @@ -184,7 +185,7 @@ public function clearCachedDefinitions() { if ($this->cacheBackend) { if ($this->cacheTags) { // Use the cache tags to clear the cache. - $this->cacheBackend->deleteTags($this->cacheTags); + Cache::deleteTags($this->cacheTags); } elseif ($this->languageManager) { $cache_keys = array(); diff --git a/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php b/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php index b3f9b5e..82acdbc 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php @@ -9,6 +9,7 @@ use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface; use Drupal\Component\Plugin\Discovery\DiscoveryInterface; +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; /** @@ -157,7 +158,7 @@ protected function setCachedDefinitions($definitions) { public function clearCachedDefinitions() { // If there are any cache tags, clear cache based on those. if (!empty($this->cacheTags)) { - cache($this->cacheBin)->deleteTags($this->cacheTags); + Cache::deleteTags($this->cacheTags); } // Otherwise, just delete the specified cache key. else if (isset($this->cacheKey)) { diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index 3c5ada7..cbe6643 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -7,6 +7,7 @@ namespace Drupal\Core\Theme; +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\DestructableInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -550,7 +551,7 @@ public function reset() { $this->runtimeRegistry = NULL; $this->registry = NULL; - $this->cache->invalidateTags(array('theme_registry' => TRUE)); + Cache::invalidateTags(array('theme_registry' => TRUE)); return $this; } diff --git a/core/modules/field/lib/Drupal/field/FieldInfo.php b/core/modules/field/lib/Drupal/field/FieldInfo.php index 4df7ab8..e458c0f 100644 --- a/core/modules/field/lib/Drupal/field/FieldInfo.php +++ b/core/modules/field/lib/Drupal/field/FieldInfo.php @@ -7,6 +7,7 @@ namespace Drupal\field; +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Field\FieldTypePluginManager; @@ -160,7 +161,7 @@ public function flush() { $this->bundleExtraFields = array(); - $this->cacheBackend->deleteTags(array('field_info' => TRUE)); + Cache::deleteTags(array('field_info' => TRUE)); } /** diff --git a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php index 715820b..fa0d2cc 100644 --- a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php +++ b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php @@ -7,6 +7,7 @@ namespace Drupal\filter\Entity; +use Drupal\Core\Cache\Cache; use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\filter\FilterFormatInterface; @@ -183,7 +184,7 @@ public function disable() { // Clear the filter cache whenever a text format is disabled. filter_formats_reset(); - cache('filter')->deleteTags(array('filter_format' => $this->format)); + Cache::deleteTags(array('filter_format' => $this->format)); return $this; } @@ -220,7 +221,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ if ($update) { // Clear the filter cache whenever a text format is updated. - cache('filter')->deleteTags(array('filter_format' => $this->id())); + Cache::deleteTags(array('filter_format' => $this->id())); } else { // Default configuration of modules and installation profiles is allowed diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 697f8c7..bd794be 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -5,6 +5,7 @@ * Admin page callbacks for the system module. */ +use Drupal\Core\Cache\Cache; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; @@ -37,7 +38,7 @@ function system_theme_default() { // enabled. \Drupal::service('router.builder')->rebuild(); menu_router_rebuild(); - \Drupal::cache('cache')->deleteTags(array('local_task' => 1)); + Cache::deleteTags(array('local_task' => TRUE)); // The status message depends on whether an admin theme is currently in use: // a value of 0 means the admin theme is set to be the default theme. diff --git a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php index 8ccec8e..b3f08cc 100644 --- a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php +++ b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php @@ -7,6 +7,7 @@ namespace Drupal\toolbar\Tests; +use Drupal\Core\Cache\Cache; use Drupal\simpletest\WebTestBase; /** @@ -284,7 +285,7 @@ function testCacheClearByCacheTag() { // Log in admin_user and clear the caches for this user using a tag. $this->drupalLogin($this->admin_user); - $toolbarCache->deleteTags(array('user' => array($admin_user_id))); + Cache::deleteTags(array('user' => array($admin_user_id))); // Assert that no toolbar cache exists for admin_user against the // language "en". diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index 096c489..86ef5ee 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -5,6 +5,7 @@ * Administration toolbar for quick access to top level administration items. */ +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Language\Language; use Drupal\Core\Template\Attribute; @@ -652,7 +653,7 @@ function _toolbar_clear_user_cache($uid = NULL) { // Clear by the 'user' tag in order to delete all caches, in any language, // associated with this user. if (isset($uid)) { - $cache->deleteTags(array('user' => array($uid))); + Cache::deleteTags(array('user' => array($uid))); } else { $cache->deleteAll(); } diff --git a/core/modules/tour/tour.api.php b/core/modules/tour/tour.api.php index db0312f..6537cc7 100644 --- a/core/modules/tour/tour.api.php +++ b/core/modules/tour/tour.api.php @@ -73,7 +73,7 @@ function hook_tour_presave($entity) { */ function hook_tour_insert($entity) { \Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); - cache('cache_tour')->deleteTags(array('tour_items')); + \Drupal\Core\Cache\Cache::deleteTags(array('tour_items')); } /** @@ -84,5 +84,5 @@ function hook_tour_insert($entity) { */ function hook_tour_update($entity) { \Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); - cache('cache_tour')->deleteTags(array('tour_items')); + \Drupal\Core\Cache\Cache::deleteTags(array('tour_items')); } diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php index 52816e2..4ba2a3c 100644 --- a/core/modules/views/views.api.php +++ b/core/modules/views/views.api.php @@ -627,7 +627,7 @@ function hook_views_ui_display_top_links_alter(array &$links, ViewExecutable $vi * @see views_invalidate_cache() */ function hook_views_invalidate_cache() { - cache('mymodule')->invalidateTags(array('views' => TRUE)); + \Drupal\Core\Cache\Cache::invalidateTags(array('views' => TRUE)); } /**