diff --git a/core/core.services.yml b/core/core.services.yml index 95c56a8..86495c0 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -30,20 +30,20 @@ services: factory_method: get factory_service: cache_factory arguments: [cache] - cache.menu: + cache.entity: class: Drupal\Core\Cache\CacheBackendInterface tags: - { name: cache.bin } factory_method: get factory_service: cache_factory - arguments: [menu] - cache.page: + arguments: [entity] + cache.render: class: Drupal\Core\Cache\CacheBackendInterface tags: - { name: cache.bin } factory_method: get factory_service: cache_factory - arguments: [page] + arguments: [render] cache.path: class: Drupal\Core\Cache\CacheBackendInterface tags: diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index c7094af..7bbaaf0 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -1118,7 +1118,7 @@ function drupal_page_get_cache($check_only = FALSE) { } if (drupal_page_is_cacheable()) { - $cache = cache('page')->get($base_root . request_uri()); + $cache = cache('render')->get($base_root . request_uri()); if ($cache !== FALSE) { $cache_hit = TRUE; } diff --git a/core/includes/common.inc b/core/includes/common.inc index 654d849..8136ccb 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -4675,7 +4675,7 @@ function drupal_page_set_cache($body) { if (config('system.performance')->get('response.gzip') && extension_loaded('zlib')) { $cache->data['body'] = gzencode($cache->data['body'], 9, FORCE_GZIP); } - cache('page')->set($cache->cid, $cache->data, $cache->expire, $cache->tags); + cache('render')->set($cache->cid, $cache->data, $cache->expire, $cache->tags); } return $cache; } diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 6617366..fcdcb26 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -356,7 +356,7 @@ function install_begin_request(&$install_state) { // Register the 'language_manager' service. $container->register('language_manager', 'Drupal\Core\Language\LanguageManager'); - foreach (array('bootstrap', 'config', 'cache', 'menu', 'page', 'path') as $bin) { + foreach (array('bootstrap', 'config', 'cache', 'entity', 'render', 'path') as $bin) { $container ->register("cache.$bin", 'Drupal\Core\Cache\MemoryBackend') ->addArgument($bin); diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 6b62bf8..5946205 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -1100,7 +1100,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_menu}. - $cache = cache('menu')->get($cid); + $cache = cache('path')->get($cid); if ($cache && isset($cache->data)) { // If the cache entry exists, it contains the parameters for // menu_build_tree(). @@ -1127,7 +1127,7 @@ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) { } // Cache the tree building parameters using the page-specific cid. - cache('menu')->set($cid, $tree_parameters, CacheBackendInterface::CACHE_PERMANENT, array('menu' => $menu_name)); + cache('path')->set($cid, $tree_parameters, CacheBackendInterface::CACHE_PERMANENT, array('menu' => $menu_name)); } // Build the tree using the parameters; the resulting tree will be cached @@ -1227,7 +1227,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_menu}. - $cache = cache('menu')->get($cid); + $cache = cache('path')->get($cid); if ($cache && isset($cache->data)) { // If the cache entry exists, it contains the parameters for // menu_build_tree(). @@ -1295,7 +1295,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. - cache('menu')->set($cid, $tree_parameters, CacheBackendInterface::CACHE_PERMANENT, array('menu' => $menu_name)); + cache('path')->set($cid, $tree_parameters, CacheBackendInterface::CACHE_PERMANENT, array('menu' => $menu_name)); } // Build the tree using the parameters; the resulting tree will be cached @@ -1364,7 +1364,7 @@ function _menu_build_tree($menu_name, array $parameters = array()) { // If we do not have this tree in the static cache, check {cache_menu}. if (!isset($trees[$tree_cid])) { - $cache = cache('menu')->get($tree_cid); + $cache = cache('path')->get($tree_cid); if ($cache && isset($cache->data)) { $trees[$tree_cid] = $cache->data; } @@ -1407,7 +1407,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. - cache('menu')->set($tree_cid, $data, CacheBackendInterface::CACHE_PERMANENT, array('menu' => $menu_name)); + cache('path')->set($tree_cid, $data, CacheBackendInterface::CACHE_PERMANENT, array('menu' => $menu_name)); $trees[$tree_cid] = $data; } @@ -2571,7 +2571,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('path')->deleteTags(array('menu' => $menu_name)); // Also clear the menu system static caches. menu_reset_static_cache(); } @@ -2583,7 +2583,7 @@ function menu_cache_clear($menu_name = 'tools') { * might have been made to the router items or menu links. */ function menu_cache_clear_all() { - cache('menu')->deleteAll(); + cache('path')->deleteAll(); menu_reset_static_cache(); } diff --git a/core/lib/Drupal/Core/Cache/CacheBackendInterface.php b/core/lib/Drupal/Core/Cache/CacheBackendInterface.php index a054604..3cdb3cd 100644 --- a/core/lib/Drupal/Core/Cache/CacheBackendInterface.php +++ b/core/lib/Drupal/Core/Cache/CacheBackendInterface.php @@ -18,9 +18,9 @@ * set a variable with the name of the cache bin as its key and the name of * your class as its value. For example, if your implementation of * Drupal\Core\Cache\CacheBackendInterface was called MyCustomCache, the - * following line would make Drupal use it for the 'cache_page' bin: + * following line would make Drupal use it for the 'cache_render' bin: * @code - * $conf['cache_classes']['cache_page'] = 'MyCustomCache'; + * $conf['cache_classes']['cache_render'] = 'MyCustomCache'; * @endcode * * Additionally, you can register your cache implementation to be used by diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 57f1572..abe58ca 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -336,7 +336,7 @@ function _block_get_renderable_region($list = array()) { '#cache' => array( 'keys' => array($id, $block->get('module')), 'granularity' => $settings['cache'], - 'bin' => 'block', + 'bin' => 'render', 'tags' => array('content' => TRUE), ), ); diff --git a/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php b/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php index b102d4b..d6e4762 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php +++ b/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php @@ -34,7 +34,7 @@ public function __construct(array $namespaces) { $this->discovery = new AnnotatedClassDiscovery('block', 'block', $namespaces); $this->discovery = new DerivativeDiscoveryDecorator($this->discovery); $this->discovery = new AlterDecorator($this->discovery, 'block'); - $this->discovery = new CacheDecorator($this->discovery, 'block_plugins:' . language(LANGUAGE_TYPE_INTERFACE)->langcode, 'block', CacheBackendInterface::CACHE_PERMANENT, array('block')); + $this->discovery = new CacheDecorator($this->discovery, 'block_plugins:' . language(LANGUAGE_TYPE_INTERFACE)->langcode, 'cache', CacheBackendInterface::CACHE_PERMANENT, array('block')); } /** diff --git a/core/modules/book/book.admin.inc b/core/modules/book/book.admin.inc index 6002151..162c394 100644 --- a/core/modules/book/book.admin.inc +++ b/core/modules/book/book.admin.inc @@ -92,7 +92,7 @@ function book_admin_edit_submit($form, &$form_state) { // Flush static and cache. drupal_static_reset('book_menu_subtree_data'); $cid = 'links:' . $form['#node']->book['menu_name'] . ':subtree-cid:' . $form['#node']->book['mlid']; - cache('menu')->delete($cid); + cache('path')->delete($cid); } drupal_set_message(t('Updated book %title.', array('%title' => $form['#node']->label()))); diff --git a/core/modules/book/book.module b/core/modules/book/book.module index d97dcf1..519e87f 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -1299,12 +1299,12 @@ function book_menu_subtree_data($link) { $cid = 'links:' . $link['menu_name'] . ':subtree-cid:' . $link['mlid']; if (!isset($tree[$cid])) { - $cache = cache('menu')->get($cid); + $cache = cache('path')->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 = cache('menu')->get($cache->data); + $cache = cache('path')->get($cache->data); if ($cache && isset($cache->data)) { $data = $cache->data; @@ -1337,11 +1337,11 @@ function book_menu_subtree_data($link) { $tree_cid = 'links:' . $item['menu_name'] . ':subtree-data:' . hash('sha256', serialize($data)); // Cache the data, if it is not already in the cache. - if (!cache('menu')->get($tree_cid)) { - cache('menu')->set($tree_cid, $data); + if (!cache('path')->get($tree_cid)) { + cache('path')->set($tree_cid, $data); } // Cache the cid of the (shared) data using the menu and item-specific cid. - cache('menu')->set($cid, $tree_cid); + cache('path')->set($cid, $tree_cid); } // Check access for the current user to each item in the tree. menu_tree_check_access($data['tree'], $data['node_links']); diff --git a/core/modules/field/field.attach.inc b/core/modules/field/field.attach.inc index cde15f4..75f0402 100644 --- a/core/modules/field/field.attach.inc +++ b/core/modules/field/field.attach.inc @@ -904,7 +904,7 @@ function field_attach_load($entity_type, $entities, $age = FIELD_LOAD_CURRENT, $ foreach ($entities as $id => $entity) { $cids[] = "field:$entity_type:$id"; } - $cache = cache('field')->getMultiple($cids); + $cache = cache('entity')->getMultiple($cids); // Put the cached field values back into the entities and remove them from // the list of entities to query. foreach ($entities as $id => $entity) { @@ -980,7 +980,7 @@ function field_attach_load($entity_type, $entities, $age = FIELD_LOAD_CURRENT, $ $data[$instance['field_name']] = $queried_entities[$id]->{$instance['field_name']}; } $cid = "field:$entity_type:$id"; - cache('field')->set($cid, $data); + cache('entity')->set($cid, $data); } } } @@ -1237,7 +1237,7 @@ function field_attach_update(EntityInterface $entity) { $entity_info = $entity->entityInfo(); if ($entity_info['field_cache']) { - cache('field')->delete('field:' . $entity->entityType() . ':' . $entity->id()); + cache('entity')->delete('field:' . $entity->entityType() . ':' . $entity->id()); } } @@ -1270,7 +1270,7 @@ function field_attach_delete(EntityInterface $entity) { $entity_info = $entity->entityInfo(); if ($entity_info['field_cache']) { - cache('field')->delete('field:' . $entity->entityType() . ':' . $entity->id()); + cache('entity')->delete('field:' . $entity->entityType() . ':' . $entity->id()); } } diff --git a/core/modules/field/field.info.inc b/core/modules/field/field.info.inc index 38edcdb..036aa38 100644 --- a/core/modules/field/field.info.inc +++ b/core/modules/field/field.info.inc @@ -73,7 +73,7 @@ function _field_info_collate_types() { $langcode = $language_interface->langcode; if (!isset($info)) { - if ($cached = cache('field')->get("field_info_types:$langcode")) { + if ($cached = cache('entity')->get("field_info_types:$langcode")) { $info = $cached->data; } else { @@ -111,7 +111,7 @@ function _field_info_collate_types() { } drupal_alter('field_storage_info', $info['storage types']); - cache('field')->set("field_info_types:$langcode", $info, CacheBackendInterface::CACHE_PERMANENT, array('field_info_types' => TRUE)); + cache('entity')->set("field_info_types:$langcode", $info, CacheBackendInterface::CACHE_PERMANENT, array('field_info_types' => TRUE)); } } @@ -124,7 +124,7 @@ function _field_info_collate_types() { function _field_info_collate_types_reset() { drupal_static_reset('_field_info_collate_types'); // Clear all languages. - cache('field')->deleteTags(array('field_info_types' => TRUE)); + cache('entity')->deleteTags(array('field_info_types' => TRUE)); } /** diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 8f459a3..919ed4f 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -669,7 +669,7 @@ function _field_extra_fields_pre_render($elements) { * Clears the field info and field data caches. */ function field_cache_clear() { - cache('field')->deleteAll(); + cache('entity')->deleteAll(); field_info_cache_clear(); } diff --git a/core/modules/field/field.services.yml b/core/modules/field/field.services.yml index 2313254..45dfe34 100644 --- a/core/modules/field/field.services.yml +++ b/core/modules/field/field.services.yml @@ -7,11 +7,4 @@ services: arguments: ['%container.namespaces%'] field.info: class: Drupal\field\FieldInfo - arguments: ['@cache.field', '@config.factory', '@module_handler'] - cache.field: - class: Drupal\Core\Cache\CacheBackendInterface - tags: - - { name: cache.bin } - factory_method: get - factory_service: cache_factory - arguments: [field] + arguments: ['@cache.entity', '@config.factory', '@module_handler'] diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php index 93950e6..b1aeeb3 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php @@ -37,7 +37,7 @@ public function __construct($namespaces) { $this->discovery = new AnnotatedClassDiscovery('field', 'formatter', $namespaces); $this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition')); $this->discovery = new AlterDecorator($this->discovery, 'field_formatter_info'); - $this->discovery = new CacheDecorator($this->discovery, 'field_formatter_types', 'field'); + $this->discovery = new CacheDecorator($this->discovery, 'field_formatter_types'); $this->factory = new FormatterFactory($this->discovery); } diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php index 6ea1879..0547af3 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php @@ -38,7 +38,7 @@ public function __construct($namespaces) { $this->discovery = new AnnotatedClassDiscovery('field', 'widget', $namespaces); $this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition')); $this->discovery = new AlterDecorator($this->discovery, 'field_widget_info'); - $this->discovery = new CacheDecorator($this->discovery, 'field_widget_types', 'field'); + $this->discovery = new CacheDecorator($this->discovery, 'field_widget_types'); $this->factory = new WidgetFactory($this->discovery); } diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php index 1ec87cf..a51fe66 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php @@ -245,18 +245,18 @@ function testFieldAttachCache() { $cid = "field:$entity_type:{$entity_init->ftid}"; // Check that no initial cache entry is present. - $this->assertFalse(cache('field')->get($cid), 'Non-cached: no initial cache entry'); + $this->assertFalse(cache('entity')->get($cid), 'Non-cached: no initial cache entry'); // Save, and check that no cache entry is present. $entity = clone($entity_init); $entity->{$this->field_name}[$langcode] = $values; field_attach_insert($entity); - $this->assertFalse(cache('field')->get($cid), 'Non-cached: no cache entry on insert'); + $this->assertFalse(cache('entity')->get($cid), 'Non-cached: no cache entry on insert'); // Load, and check that no cache entry is present. $entity = clone($entity_init); field_attach_load($entity_type, array($entity->ftid => $entity)); - $this->assertFalse(cache('field')->get($cid), 'Non-cached: no cache entry on load'); + $this->assertFalse(cache('entity')->get($cid), 'Non-cached: no cache entry on load'); // Cacheable entity type. @@ -272,24 +272,24 @@ function testFieldAttachCache() { field_create_instance($instance); // Check that no initial cache entry is present. - $this->assertFalse(cache('field')->get($cid), 'Cached: no initial cache entry'); + $this->assertFalse(cache('entity')->get($cid), 'Cached: no initial cache entry'); // Save, and check that no cache entry is present. $entity = clone($entity_init); $entity->{$this->field_name}[$langcode] = $values; field_attach_insert($entity); - $this->assertFalse(cache('field')->get($cid), 'Cached: no cache entry on insert'); + $this->assertFalse(cache('entity')->get($cid), 'Cached: no cache entry on insert'); // Load a single field, and check that no cache entry is present. $entity = clone($entity_init); field_attach_load($entity_type, array($entity->ftid => $entity), FIELD_LOAD_CURRENT, array('field_id' => $this->field_id)); - $cache = cache('field')->get($cid); - $this->assertFalse(cache('field')->get($cid), 'Cached: no cache entry on loading a single field'); + $cache = cache('entity')->get($cid); + $this->assertFalse(cache('entity')->get($cid), 'Cached: no cache entry on loading a single field'); // Load, and check that a cache entry is present with the expected values. $entity = clone($entity_init); field_attach_load($entity_type, array($entity->ftid => $entity)); - $cache = cache('field')->get($cid); + $cache = cache('entity')->get($cid); $this->assertEqual($cache->data[$this->field_name][$langcode], $values, 'Cached: correct cache entry on load'); // Update with different values, and check that the cache entry is wiped. @@ -297,12 +297,12 @@ function testFieldAttachCache() { $entity = clone($entity_init); $entity->{$this->field_name}[$langcode] = $values; field_attach_update($entity); - $this->assertFalse(cache('field')->get($cid), 'Cached: no cache entry on update'); + $this->assertFalse(cache('entity')->get($cid), 'Cached: no cache entry on update'); // Load, and check that a cache entry is present with the expected values. $entity = clone($entity_init); field_attach_load($entity_type, array($entity->ftid => $entity)); - $cache = cache('field')->get($cid); + $cache = cache('entity')->get($cid); $this->assertEqual($cache->data[$this->field_name][$langcode], $values, 'Cached: correct cache entry on load'); // Create a new revision, and check that the cache entry is wiped. @@ -315,18 +315,18 @@ function testFieldAttachCache() { $entity = clone($entity_init); $entity->{$this->field_name}[$langcode] = $values; field_attach_update($entity); - $cache = cache('field')->get($cid); - $this->assertFalse(cache('field')->get($cid), 'Cached: no cache entry on new revision creation'); + $cache = cache('entity')->get($cid); + $this->assertFalse(cache('entity')->get($cid), 'Cached: no cache entry on new revision creation'); // Load, and check that a cache entry is present with the expected values. $entity = clone($entity_init); field_attach_load($entity_type, array($entity->ftid => $entity)); - $cache = cache('field')->get($cid); + $cache = cache('entity')->get($cid); $this->assertEqual($cache->data[$this->field_name][$langcode], $values, 'Cached: correct cache entry on load'); // Delete, and check that the cache entry is wiped. field_attach_delete($entity); - $this->assertFalse(cache('field')->get($cid), 'Cached: no cache entry after delete'); + $this->assertFalse(cache('entity')->get($cid), 'Cached: no cache entry after delete'); } /** diff --git a/core/modules/filter/filter.api.php b/core/modules/filter/filter.api.php index 49311c8..7793f1a 100644 --- a/core/modules/filter/filter.api.php +++ b/core/modules/filter/filter.api.php @@ -205,9 +205,9 @@ function hook_filter_FILTER_settings($form, &$form_state, $filter, $format, $def * The language code of the text to be filtered. * @param $cache * A Boolean indicating whether the filtered text is going to be cached in - * {cache_filter}. + * {cache_render}. * @param $cache_id - * The ID of the filtered text in {cache_filter}, if $cache is TRUE. + * The ID of the filtered text in {cache_render}, if $cache is TRUE. * * @return * The prepared, escaped text. @@ -238,9 +238,9 @@ function hook_filter_FILTER_prepare($text, $filter, $format, $langcode, $cache, * The language code of the text to be filtered. * @param $cache * A Boolean indicating whether the filtered text is going to be cached in - * {cache_filter}. + * {cache_render}. * @param $cache_id - * The ID of the filtered text in {cache_filter}, if $cache is TRUE. + * The ID of the filtered text in {cache_render}, if $cache is TRUE. * * @return * The filtered text. diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 57ff8c2..b2fc286 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -662,7 +662,7 @@ function filter_list_format($format_id) { * text replacement can be implemented. Defaults to an empty string. * @param $cache * (optional) A Boolean indicating whether to cache the filtered output in the - * {cache_filter} table. The caller may set this to FALSE when the output is + * {cache_render} table. The caller may set this to FALSE when the output is * already cached elsewhere to avoid duplicate cache lookups and storage. * Defaults to FALSE. * @param array $filter_types_to_skip @@ -701,7 +701,7 @@ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE, $cache_id = ''; if ($cache) { $cache_id = $format->format . ':' . $langcode . ':' . hash('sha256', $text); - if ($cached = cache('filter')->get($cache_id)) { + if ($cached = cache('render')->get($cache_id)) { return $cached->data; } } @@ -743,7 +743,7 @@ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE, // automatically flushed when the text format is updated. // @see Drupal\filter\Plugin\Core\Entity\FilterFormat::save() if ($cache) { - cache('filter')->set($cache_id, $text, CacheBackendInterface::CACHE_PERMANENT, array('filter_format' => $format->format)); + cache('render')->set($cache_id, $text, CacheBackendInterface::CACHE_PERMANENT, array('filter_format' => $format->format)); } return $text; diff --git a/core/modules/filter/lib/Drupal/filter/FilterFormatStorageController.php b/core/modules/filter/lib/Drupal/filter/FilterFormatStorageController.php index 1e8bdb2..3f1dc31 100644 --- a/core/modules/filter/lib/Drupal/filter/FilterFormatStorageController.php +++ b/core/modules/filter/lib/Drupal/filter/FilterFormatStorageController.php @@ -75,7 +75,7 @@ protected function postSave(EntityInterface $entity, $update) { if ($update) { // Clear the filter cache whenever a text format is updated. - cache('filter')->deleteTags(array('filter_format' => $entity->id())); + cache('render')->deleteTags(array('filter_format' => $entity->id())); } else { // Default configuration of modules and installation profiles is allowed diff --git a/core/modules/filter/lib/Drupal/filter/Plugin/Core/Entity/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Plugin/Core/Entity/FilterFormat.php index 202c0fe..3ee6c6e 100644 --- a/core/modules/filter/lib/Drupal/filter/Plugin/Core/Entity/FilterFormat.php +++ b/core/modules/filter/lib/Drupal/filter/Plugin/Core/Entity/FilterFormat.php @@ -150,7 +150,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('render')->deleteTags(array('filter_format' => $this->format)); return $this; } diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php index 81d5321..ac9e8f7 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php @@ -143,7 +143,7 @@ function testFilterAdmin() { $this->drupalGet('admin/config/content/formats/' . $basic); $this->assertFieldByName('filters[filter_html][settings][allowed_html]', $edit['filters[filter_html][settings][allowed_html]'], 'Allowed HTML tag added.'); - $this->assertTrue(cache('filter')->isEmpty(), 'Cache cleared.'); + $this->assertTrue(cache('render')->isEmpty(), 'Cache cleared.'); $elements = $this->xpath('//select[@name=:first]/following::select[@name=:second]', array( ':first' => 'filters[' . $first_filter . '][weight]', diff --git a/core/modules/image/image.module b/core/modules/image/image.module index f95c633..89dd53f 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -704,10 +704,7 @@ function image_style_flush($style) { drupal_theme_rebuild(); // Clear page caches when flushing. - if (module_exists('block')) { - cache('block')->deleteAll(); - } - cache('page')->deleteAll(); + cache('render')->deleteAll(); } /** diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index c2da3b5..69239bd 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -292,7 +292,7 @@ function locale_stream_wrappers() { function locale_language_insert($language) { // @todo move these two cache clears out. See http://drupal.org/node/1293252 // Changing the language settings impacts the interface. - cache('page')->deleteAll(); + cache('render')->deleteAll(); // Force JavaScript translation file re-creation for the new language. _locale_invalidate_js($language->langcode); } @@ -303,7 +303,7 @@ function locale_language_insert($language) { function locale_language_update($language) { // @todo move these two cache clears out. See http://drupal.org/node/1293252 // Changing the language settings impacts the interface. - cache('page')->deleteAll(); + cache('render')->deleteAll(); // Force JavaScript translation file re-creation for the modified language. _locale_invalidate_js($language->langcode); } @@ -324,7 +324,7 @@ function locale_language_delete($language) { // Changing the language settings impacts the interface: _locale_invalidate_js($language->langcode); - cache('page')->deleteAll(); + cache('render')->deleteAll(); // Clear locale translation caches. locale_translation_status_delete_languages(array($language->langcode)); diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookExitTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookExitTest.php index 0a8ef18..859b912 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookExitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookExitTest.php @@ -50,18 +50,18 @@ function testHookExit() { $this->drupalGet(''); $calls++; $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit called with normal cache and no cached page.'); - $this->assertTrue(cache('page')->get(url('', array('absolute' => TRUE))), 'Page has been cached.'); + $this->assertTrue(cache('render')->get(url('', array('absolute' => TRUE))), 'Page has been cached.'); $this->drupalGet(''); $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit not called with normal cache and a cached page.'); // Test with aggressive cache. Exit should not fire since page is cached. variable_set('page_cache_invoke_hooks', FALSE); - $this->assertTrue(cache('page')->get(url('', array('absolute' => TRUE))), 'Page has been cached.'); + $this->assertTrue(cache('render')->get(url('', array('absolute' => TRUE))), 'Page has been cached.'); $this->drupalGet(''); $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit not called with aggressive cache and a cached page.'); // Test with page cache cleared, exit should be called. - $this->assertTrue(db_delete('cache_page')->execute(), 'Page cache cleared.'); + $this->assertTrue(db_delete('cache_render')->execute(), 'Page cache cleared.'); $this->drupalGet(''); $calls++; $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit called with aggressive cache and no cached page.'); 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 ec1107c..c2a2d93 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,6 @@ function testFlushAllCaches() { // Create cache entries for each flushed cache bin. $bins = Cache::getBins(); $this->assertTrue($bins, 'cache_get_bins() returned bins to flush.'); - $bins['menu'] = $this->container->get('cache.menu'); foreach ($bins as $bin => $cache_backend) { $cid = 'test_cid_clear' . $bin; $cache_backend->set($cid, $this->default_value); diff --git a/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php index 06f3fc0..5180416 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php @@ -56,7 +56,7 @@ */ protected function getTestBin() { if (!isset($this->testBin)) { - $this->testBin = 'page'; + $this->testBin = 'render'; } return $this->testBin; } @@ -394,7 +394,7 @@ function testDeleteTags() { // (test_cid_invalidate1 and test_cid_invalidate2) still exist from previous // tests. $tags = array('test_tag' => array(1, 2, 3)); - $bins = array('path', 'bootstrap', 'page'); + $bins = array('path', 'bootstrap', 'render'); foreach ($bins as $bin) { $this->getCacheBackend($bin)->set('test', $this->defaultValue, CacheBackendInterface::CACHE_PERMANENT, $tags); $this->assertTrue($this->getCacheBackend($bin)->get('test'), 'Cache item was set in bin.'); @@ -501,7 +501,7 @@ function testInvalidateTags() { // (test_cid_invalidate1 and test_cid_invalidate2) still exist from previous // tests. $tags = array('test_tag' => array(1, 2, 3)); - $bins = array('path', 'bootstrap', 'page'); + $bins = array('path', 'bootstrap', 'render'); foreach ($bins as $bin) { $this->getCacheBackend($bin)->set('test', $this->defaultValue, CacheBackendInterface::CACHE_PERMANENT, $tags); $this->assertTrue($this->getCacheBackend($bin)->get('test'), 'Cache item was set in bin.'); diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 8c14060..4f4646e 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1753,7 +1753,7 @@ function system_clear_cache_submit($form, &$form_state) { * @ingroup forms */ function system_clear_page_cache_submit($form, &$form_state) { - cache('page')->deleteAll(); + cache('render')->deleteAll(); } /** diff --git a/core/modules/system/system.install b/core/modules/system/system.install index e23bf8e..55174ca 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -2083,6 +2083,14 @@ function system_update_8053() { } /** + * Remove no longer used cache bins. + */ +function system_update_8054() { + db_drop_table('cache_menu'); + db_drop_table('cache_page'); +} + +/** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */ 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 7df986e..a32b33d 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 @@ -32,9 +32,14 @@ var $storage = array(); /** - * What table to store data in. + * Which cache bin to store the rendered output in. */ - var $table = 'views_results'; + var $output_bin = 'render'; + + /** + * Which cache bin to store query results in. + */ + var $results_bin = 'path'; /** * Stores the cache ID used for the results cache. @@ -125,12 +130,12 @@ function cache_set($type) { 'total_rows' => isset($this->view->total_rows) ? $this->view->total_rows : 0, 'current_page' => $this->view->getCurrentPage(), ); - cache($this->table)->set($this->generateResultsKey(), $data, $this->cache_set_expire($type)); + cache($this->results_bin)->set($this->generateResultsKey(), $data, $this->cache_set_expire($type)); break; case 'output': $this->storage['output'] = $this->view->display_handler->output; $this->gather_headers(); - cache($this->table)->set($this->generateOutputKey(), $this->storage, $this->cache_set_expire($type)); + cache($this->output_bin)->set($this->generateOutputKey(), $this->storage, $this->cache_set_expire($type)); break; } } @@ -150,7 +155,7 @@ function cache_get($type) { case 'results': // Values to set: $view->result, $view->total_rows, $view->execute_time, // $view->current_page. - if ($cache = cache($this->table)->get($this->generateResultsKey())) { + if ($cache = cache($this->results_bin)->get($this->generateResultsKey())) { if (!$cutoff || $cache->created > $cutoff) { $this->view->result = $cache->data['result']; $this->view->total_rows = $cache->data['total_rows']; @@ -161,7 +166,7 @@ function cache_get($type) { } return FALSE; case 'output': - if ($cache = cache($this->table)->get($this->generateOutputKey())) { + if ($cache = cache($this->output_bin)->get($this->generateOutputKey())) { if (!$cutoff || $cache->created > $cutoff) { $this->storage = $cache->data; $this->view->display_handler->output = $cache->data['output']; @@ -180,7 +185,8 @@ function cache_get($type) { * to be sure that we catch everything. Maybe that's a bad idea. */ function cache_flush() { - cache($this->table)->deleteTags(array($this->view->storage->id() => TRUE)); + cache($this->output_bin)->deleteTags(array($this->view->storage->get('name') => TRUE)); + cache($this->results_bin)->deleteTags(array($this->view->storage->get('name') => TRUE)); } /** diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 8e2a378..7961547 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -656,7 +656,10 @@ function views_language_list($field = 'name', $flags = LANGUAGE_ALL) { */ function views_field_create_instance($instance) { cache('views_info')->deleteAll(); - cache('views_results')->deleteAll(); + // @todo: Is this necessary? + cache('path')->deleteAll(); + cache('render')->deleteAll(); + } /** @@ -664,7 +667,9 @@ function views_field_create_instance($instance) { */ function views_field_update_instance($instance, $prior_instance) { cache('views_info')->deleteAll(); - cache('views_results')->deleteAll(); + // @todo: Is this necessary? + cache('path')->deleteAll(); + cache('render')->deleteAll(); } /** @@ -672,7 +677,9 @@ function views_field_update_instance($instance, $prior_instance) { */ function views_field_delete_instance($instance) { cache('views_info')->deleteAll(); - cache('views_results')->deleteAll(); + // @todo: Is this necessary? + cache('path')->deleteAll(); + cache('render')->deleteAll(); } /** diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml index 7263f67..e4dc0ab 100644 --- a/core/modules/views/views.services.yml +++ b/core/modules/views/views.services.yml @@ -71,10 +71,3 @@ services: factory_method: get factory_service: cache_factory arguments: [views_info] - cache.views_results: - class: Drupal\Core\Cache\CacheBackendInterface - tags: - - { name: cache.bin } - factory_method: get - factory_service: cache_factory - arguments: [views_results]