diff --git a/core/core.services.yml b/core/core.services.yml index 09eff9b..dfc6c10 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -43,13 +43,13 @@ services: factory_method: get factory_service: cache_factory arguments: [render] - cache.path: + cache.data: class: Drupal\Core\Cache\CacheBackendInterface tags: - { name: cache.bin } factory_method: get factory_service: cache_factory - arguments: [path] + arguments: [data] config.cachedstorage.storage: class: Drupal\Core\Config\FileStorage factory_class: Drupal\Core\Config\FileStorageFactory @@ -180,13 +180,13 @@ services: arguments: ['@entity.manager', '@form_builder'] plugin.manager.field.field_type: class: Drupal\Core\Field\FieldTypePluginManager - arguments: ['@container.namespaces', '@cache.entity', '@language_manager', '@module_handler'] + arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler'] plugin.manager.field.widget: class: Drupal\Core\Field\WidgetPluginManager - arguments: ['@container.namespaces', '@cache.entity', '@module_handler', '@language_manager', '@plugin.manager.field.field_type'] + arguments: ['@container.namespaces', '@cache.cache', '@module_handler', '@language_manager', '@plugin.manager.field.field_type'] plugin.manager.field.formatter: class: Drupal\Core\Field\FormatterPluginManager - arguments: ['@container.namespaces', '@cache.entity', '@module_handler', '@language_manager', '@plugin.manager.field.field_type'] + arguments: ['@container.namespaces', '@cache.cache', '@module_handler', '@language_manager', '@plugin.manager.field.field_type'] plugin.manager.archiver: class: Drupal\Core\Archiver\ArchiverManager parent: default_plugin_manager @@ -322,7 +322,7 @@ services: - { name: event_subscriber } path.alias_manager.cached: class: Drupal\Core\CacheDecorator\AliasManagerCacheDecorator - arguments: ['@path.alias_manager', '@cache.path'] + arguments: ['@path.alias_manager', '@cache.data'] path.crud: class: Drupal\Core\Path\Path arguments: ['@database', '@module_handler'] diff --git a/core/includes/menu.inc b/core/includes/menu.inc index c5a2d13..abba018 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -445,7 +445,7 @@ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) { if (!isset($tree[$cid])) { // If the static variable doesn't have the data, check {cache_path}. - $cache = \Drupal::cache('path')->get($cid); + $cache = \Drupal::cache('data')->get($cid); if ($cache && isset($cache->data)) { // If the cache entry exists, it contains the parameters for // menu_build_tree(). @@ -472,7 +472,7 @@ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) { } // Cache the tree building parameters using the page-specific cid. - \Drupal::cache('path')->set($cid, $tree_parameters, Cache::PERMANENT, array('menu' => $menu_name)); + \Drupal::cache('data')->set($cid, $tree_parameters, Cache::PERMANENT, array('menu' => $menu_name)); } // Build the tree using the parameters; the resulting tree will be cached @@ -580,7 +580,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = if (!isset($tree[$cid])) { // If the static variable doesn't have the data, check {cache_path}. - $cache = \Drupal::cache('path')->get($cid); + $cache = \Drupal::cache('data')->get($cid); if ($cache && isset($cache->data)) { // If the cache entry exists, it contains the parameters for // menu_build_tree(). @@ -648,7 +648,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = $tree_parameters['active_trail'] = $active_trail; } // Cache the tree building parameters using the page-specific cid. - \Drupal::cache('path')->set($cid, $tree_parameters, Cache::PERMANENT, array('menu' => $menu_name)); + \Drupal::cache('data')->set($cid, $tree_parameters, Cache::PERMANENT, array('menu' => $menu_name)); } // Build the tree using the parameters; the resulting tree will be cached @@ -716,7 +716,7 @@ function _menu_build_tree($menu_name, array $parameters = array()) { // If we do not have this tree in the static cache, check {cache_path}. if (!isset($trees[$tree_cid])) { - $cache = \Drupal::cache('path')->get($tree_cid); + $cache = \Drupal::cache('data')->get($tree_cid); if ($cache && isset($cache->data)) { $trees[$tree_cid] = $cache->data; } @@ -759,7 +759,7 @@ function _menu_build_tree($menu_name, array $parameters = array()) { menu_tree_collect_node_links($data['tree'], $data['node_links']); // Cache the data, if it is not already in the cache. - \Drupal::cache('path')->set($tree_cid, $data, Cache::PERMANENT, array('menu' => $menu_name)); + \Drupal::cache('data')->set($tree_cid, $data, Cache::PERMANENT, array('menu' => $menu_name)); $trees[$tree_cid] = $data; } @@ -1538,7 +1538,7 @@ function menu_get_active_trail() { * might have been made to the router items or menu links. */ function menu_cache_clear_all() { - \Drupal::cache('path')->deleteAll(); + \Drupal::cache('data')->deleteAll(); menu_reset_static_cache(); } diff --git a/core/modules/book/lib/Drupal/book/BookManager.php b/core/modules/book/lib/Drupal/book/BookManager.php index f5befe5..6cfbb3d 100644 --- a/core/modules/book/lib/Drupal/book/BookManager.php +++ b/core/modules/book/lib/Drupal/book/BookManager.php @@ -444,7 +444,7 @@ public function deleteFromBook($nid) { } $this->updateOriginalParent($original); $this->books = NULL; - \Drupal::cache('path')->deleteTags(array('bid' => $original['bid'])); + \Drupal::cache('data')->deleteTags(array('bid' => $original['bid'])); } /** @@ -608,7 +608,7 @@ protected function _menu_build_tree($bid, array $parameters = array()) { // If we do not have this tree in the static cache, check {cache_menu}. if (!isset($trees[$tree_cid])) { - $cache = \Drupal::cache('path')->get($tree_cid); + $cache = \Drupal::cache('data')->get($tree_cid); if ($cache && isset($cache->data)) { $trees[$tree_cid] = $cache->data; } @@ -651,7 +651,7 @@ protected function _menu_build_tree($bid, array $parameters = array()) { $this->bookTreeCollectNodeLinks($data['tree'], $data['node_links']); // Cache the data, if it is not already in the cache. - \Drupal::cache('path')->set($tree_cid, $data, Cache::PERMANENT, array('bid' => $bid)); + \Drupal::cache('data')->set($tree_cid, $data, Cache::PERMANENT, array('bid' => $bid)); $trees[$tree_cid] = $data; } @@ -744,7 +744,7 @@ public function saveBookLink(array $link, $new) { $query->execute(); } foreach ($affected_bids as $bid) { - \Drupal::cache('path')->deleteTags(array('bid' => $bid)); + \Drupal::cache('data')->deleteTags(array('bid' => $bid)); } } @@ -1030,12 +1030,12 @@ public function bookMenuSubtreeData($link) { $cid = 'book-links:subtree-cid:' . $link['nid']; if (!isset($tree[$cid])) { - $cache = \Drupal::cache('path')->get($cid); + $cache = \Drupal::cache('data')->get($cid); if ($cache && isset($cache->data)) { // If the cache entry exists, it will just be the cid for the actual data. // This avoids duplication of large amounts of data. - $cache = \Drupal::cache('path')->get($cache->data); + $cache = \Drupal::cache('data')->get($cache->data); if ($cache && isset($cache->data)) { $data = $cache->data; @@ -1064,11 +1064,11 @@ public function bookMenuSubtreeData($link) { $tree_cid = 'book-links:subtree-data:' . hash('sha256', serialize($data)); // Cache the data, if it is not already in the cache. - if (!\Drupal::cache('path')->get($tree_cid)) { - \Drupal::cache('path')->set($tree_cid, $data, Cache::PERMANENT, array('bid' => $link['bid'])); + if (!\Drupal::cache('data')->get($tree_cid)) { + \Drupal::cache('data')->set($tree_cid, $data, Cache::PERMANENT, array('bid' => $link['bid'])); } // Cache the cid of the (shared) data using the menu and item-specific cid. - \Drupal::cache('path')->set($cid, $tree_cid, Cache::PERMANENT, array('bid' => $link['bid'])); + \Drupal::cache('data')->set($cid, $tree_cid, Cache::PERMANENT, array('bid' => $link['bid'])); } // Check access for the current user to each item in the tree. $this->bookTreeCheckAccess($data['tree'], $data['node_links']); diff --git a/core/modules/book/lib/Drupal/book/Form/BookAdminEditForm.php b/core/modules/book/lib/Drupal/book/Form/BookAdminEditForm.php index 68fb5c6..fb9a1d3 100644 --- a/core/modules/book/lib/Drupal/book/Form/BookAdminEditForm.php +++ b/core/modules/book/lib/Drupal/book/Form/BookAdminEditForm.php @@ -63,7 +63,7 @@ public function __construct(CacheBackendInterface $cache, EntityStorageControlle public static function create(ContainerInterface $container) { $entity_manager = $container->get('entity.manager'); return new static( - $container->get('cache.path'), + $container->get('cache.data'), $entity_manager->getStorageController('node'), $container->get('book.manager') ); diff --git a/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php b/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php index e97101d..ab53370 100644 --- a/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php +++ b/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php @@ -55,15 +55,15 @@ function testPathCache() { // Visit the system path for the node and confirm a cache entry is // created. - \Drupal::cache('path')->deleteAll(); + \Drupal::cache('data')->deleteAll(); // Make sure the path is not converted to the alias. $this->drupalGet($edit['source'], array('alias' => TRUE)); - $this->assertTrue(\Drupal::cache('path')->get($edit['source']), 'Cache entry was created.'); + $this->assertTrue(\Drupal::cache('data')->get($edit['source']), 'Cache entry was created.'); // Visit the alias for the node and confirm a cache entry is created. - \Drupal::cache('path')->deleteAll(); + \Drupal::cache('data')->deleteAll(); $this->drupalGet($edit['alias']); - $this->assertTrue(\Drupal::cache('path')->get($edit['source']), 'Cache entry was created.'); + $this->assertTrue(\Drupal::cache('data')->get($edit['source']), 'Cache entry was created.'); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/Cache/ClearTest.php b/core/modules/system/lib/Drupal/system/Tests/Cache/ClearTest.php index 97821a7..64aff85 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Cache/ClearTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Cache/ClearTest.php @@ -36,7 +36,7 @@ function testFlushAllCaches() { // Create cache entries for each flushed cache bin. $bins = Cache::getBins(); $this->assertTrue($bins, 'cache_get_bins() returned bins to flush.'); - $bins['path'] = $this->container->get('cache.path'); + $bins['path'] = $this->container->get('cache.data'); foreach ($bins as $bin => $cache_backend) { $cid = 'test_cid_clear' . $bin; $cache_backend->set($cid, $this->default_value); diff --git a/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php index 0a1fb76..2f24483 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php +++ b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php @@ -48,7 +48,7 @@ class ViewsHandlerManager extends PluginManagerBase { */ public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data) { $this->discovery = new ViewsHandlerDiscovery($handler_type, $namespaces); - $this->discovery = new CacheDecorator($this->discovery, "views:$handler_type", 'views_info'); + $this->discovery = new CacheDecorator($this->discovery, "views:{$handler_type}_plugins", 'data'); $this->factory = new ContainerFactory($this); diff --git a/core/modules/views/lib/Drupal/views/Plugin/ViewsPluginManager.php b/core/modules/views/lib/Drupal/views/Plugin/ViewsPluginManager.php index bcf2c85..e03f3b7 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/ViewsPluginManager.php +++ b/core/modules/views/lib/Drupal/views/Plugin/ViewsPluginManager.php @@ -44,7 +44,7 @@ public function __construct($type, \Traversable $namespaces, CacheBackendInterfa ); $this->alterInfo('views_plugins_' . $type); - $this->setCacheBackend($cache_backend, $language_manager, 'views_' . $type . '_plugins'); + $this->setCacheBackend($cache_backend, $language_manager, "views:{$type}_plugins"); } } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php index ec875e1..ec79639 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php @@ -43,7 +43,7 @@ * * @var string */ - protected $resultsBin = 'path'; + protected $resultsBin = 'data'; /** * Stores the cache ID used for the results cache. diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index db9eff1..53260d6 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -157,15 +157,15 @@ public function initDisplay(ViewExecutable $view, array &$display, array &$optio $skip_cache = \Drupal::config('views.settings')->get('skip_cache'); if (empty($view->editing) || !$skip_cache) { - $cid = 'unpackOptions:' . hash('sha256', serialize(array($this->options, $options))) . ':' . \Drupal::languageManager()->getCurrentLanguage()->id; + $cid = 'views:unpack_options:' . hash('sha256', serialize(array($this->options, $options))) . ':' . \Drupal::languageManager()->getCurrentLanguage()->id; if (empty(static::$unpackOptions[$cid])) { - $cache = \Drupal::cache('views_info')->get($cid); + $cache = \Drupal::cache('data')->get($cid); if (!empty($cache->data)) { $this->options = $cache->data; } else { $this->unpackOptions($this->options, $options); - \Drupal::cache('views_info')->set($cid, $this->options); + \Drupal::cache('data')->set($cid, $this->options); } static::$unpackOptions[$cid] = $this->options; } diff --git a/core/modules/views/views.install b/core/modules/views/views.install index 8d4ea91..e8e3e5e 100644 --- a/core/modules/views/views.install +++ b/core/modules/views/views.install @@ -5,24 +5,9 @@ * Contains install and update functions for Views. */ -use Drupal\Core\Database\Database; - /** * Implements hook_install(). */ function views_install() { module_set_weight('views', 10); } - -/** - * Provide an initial schema. - * - * @see UpdateModuleHandler::enable(). - */ -function views_schema_0() { - module_load_install('system'); - // Add the cache_views_info table. - $cache_schema = system_schema_cache_8007(); - $schema['cache_views_info'] = $cache_schema; - return $schema; -} diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 6a553bf..6770085 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -492,9 +492,9 @@ function views_language_list($field = 'name', $flags = Language::STATE_ALL) { * Implements hook_ENTITY_TYPE_create() for 'field_instance_config'. */ function views_field_instance_config_create(FieldInstanceConfigInterface $field_instance) { - \Drupal::cache('views_info')->deleteAll(); + \Drupal::cache('data')->deleteAll(); // @todo: Is this necessary? - \Drupal::cache('path')->deleteAll(); + \Drupal::cache('data')->deleteAll(); \Drupal::cache('render')->deleteAll(); } @@ -502,9 +502,9 @@ function views_field_instance_config_create(FieldInstanceConfigInterface $field_ * Implements hook_ENTITY_TYPE_update() for 'field_instance_config'. */ function views_field_instance_config_update(FieldInstanceConfigInterface $field_instance) { - \Drupal::cache('views_info')->deleteAll(); + \Drupal::cache('data')->deleteAll(); // @todo: Is this necessary? - \Drupal::cache('path')->deleteAll(); + \Drupal::cache('data')->deleteAll(); \Drupal::cache('render')->deleteAll(); } @@ -512,9 +512,9 @@ function views_field_instance_config_update(FieldInstanceConfigInterface $field_ * Implements hook_ENTITY_TYPE_delete() for 'field_instance_config'. */ function views_field_instance_config_delete(FieldInstanceConfigInterface $field_instance) { - \Drupal::cache('views_info')->deleteAll(); + \Drupal::cache('data')->deleteAll(); // @todo: Is this necessary? - \Drupal::cache('path')->deleteAll(); + \Drupal::cache('data')->deleteAll(); \Drupal::cache('render')->deleteAll(); } @@ -523,7 +523,7 @@ function views_field_instance_config_delete(FieldInstanceConfigInterface $field_ */ function views_invalidate_cache() { // Clear the views cache. - \Drupal::cache('views_info')->deleteAll(); + \Drupal::cache('data')->deleteAll(); // Clear the page and block cache. Cache::deleteTags(array('content' => TRUE)); diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml index 23700fd..2f65944 100644 --- a/core/modules/views/views.services.yml +++ b/core/modules/views/views.services.yml @@ -1,7 +1,7 @@ services: plugin.manager.views.access: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [access, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [access, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] plugin.manager.views.area: class: Drupal\views\Plugin\ViewsHandlerManager arguments: [area, '@container.namespaces', '@views.views_data'] @@ -10,22 +10,22 @@ services: arguments: [argument, '@container.namespaces', '@views.views_data'] plugin.manager.views.argument_default: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [argument_default, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [argument_default, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] plugin.manager.views.argument_validator: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [argument_validator, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [argument_validator, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] plugin.manager.views.cache: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [cache, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [cache, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] plugin.manager.views.display_extender: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [display_extender, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [display_extender, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] plugin.manager.views.display: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [display, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [display, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] plugin.manager.views.exposed_form: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [exposed_form, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [exposed_form, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] plugin.manager.views.field: class: Drupal\views\Plugin\ViewsHandlerManager arguments: [field, '@container.namespaces', '@views.views_data'] @@ -37,28 +37,28 @@ services: arguments: [join, '@container.namespaces', '@views.views_data'] plugin.manager.views.pager: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [pager, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [pager, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] plugin.manager.views.query: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [query, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [query, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] plugin.manager.views.relationship: class: Drupal\views\Plugin\ViewsHandlerManager arguments: [relationship, '@container.namespaces', '@views.views_data'] plugin.manager.views.row: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [row, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [row, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] plugin.manager.views.sort: class: Drupal\views\Plugin\ViewsHandlerManager arguments: [sort, '@container.namespaces', '@views.views_data'] plugin.manager.views.style: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [style, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [style, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] plugin.manager.views.wizard: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [wizard, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] + arguments: [wizard, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler'] views.views_data: class: Drupal\views\ViewsData - arguments: ['@cache.views_info', '@config.factory', '@module_handler', '@language_manager'] + arguments: ['@cache.data', '@config.factory', '@module_handler', '@language_manager'] views.views_data_helper: class: Drupal\views\ViewsDataHelper arguments: ['@views.views_data'] @@ -68,13 +68,6 @@ services: views.analyzer: class: Drupal\views\Analyzer arguments: ['@module_handler'] - cache.views_info: - class: Drupal\Core\Cache\CacheBackendInterface - tags: - - { name: cache.bin } - factory_method: get - factory_service: cache_factory - arguments: [views_info] views.route_subscriber: class: Drupal\views\EventSubscriber\RouteSubscriber arguments: ['@entity.manager', '@state']