diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index e1c15fe..ad0ce0e 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -1112,7 +1112,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 86fc44a..3b54153 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -4979,7 +4979,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 2395f70..7dc7a62 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -350,7 +350,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 57681a3..6c32174 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 d38a094..f39667d 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/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php index 91a7d01..cf77a63 100644 --- a/core/lib/Drupal/Core/CoreBundle.php +++ b/core/lib/Drupal/Core/CoreBundle.php @@ -451,7 +451,7 @@ protected function registerCache(ContainerBuilder $container) { $container ->register('cache.backend.memory', 'Drupal\Core\Cache\MemoryBackendFactory'); // Register a service for each bin for injecting purposes. - foreach (array('bootstrap', 'config', 'cache', 'menu', 'page', 'path') as $bin) { + foreach (array('bootstrap', 'config', 'cache', 'entity', 'render', 'path') as $bin) { CacheFactory::registerBin($container, $bin); } diff --git a/core/modules/block/block.install b/core/modules/block/block.install index b1fc925..01c5779 100644 --- a/core/modules/block/block.install +++ b/core/modules/block/block.install @@ -7,17 +7,6 @@ use Drupal\Component\Uuid\Uuid; /** - * Implements hook_schema(). - */ -function block_schema() { - - $schema['cache_block'] = drupal_get_schema_unprocessed('system', 'cache'); - $schema['cache_block']['description'] = 'Cache table for the Block module to store already built blocks, identified by module, delta, and various contexts which may change the block, such as theme, locale, and caching mode defined for the block.'; - - return $schema; -} - -/** * Implements hook_install(). */ function block_install() { diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 42f22fa..6399090 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -339,7 +339,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/BlockBundle.php b/core/modules/block/lib/Drupal/block/BlockBundle.php index 1dd86e1..eaad51f 100644 --- a/core/modules/block/lib/Drupal/block/BlockBundle.php +++ b/core/modules/block/lib/Drupal/block/BlockBundle.php @@ -23,7 +23,6 @@ public function build(ContainerBuilder $container) { // Register the BlockManager class with the dependency injection container. $container->register('plugin.manager.block', 'Drupal\block\Plugin\Type\BlockManager') ->addArgument('%container.namespaces%'); - CacheFactory::registerBin($container, 'block'); } } diff --git a/core/modules/book/book.module b/core/modules/book/book.module index 26f324e..dd07abb 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -1301,12 +1301,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; @@ -1339,11 +1339,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 69102f4..995d9f9 100644 --- a/core/modules/field/field.attach.inc +++ b/core/modules/field/field.attach.inc @@ -903,7 +903,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) { @@ -979,7 +979,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); } } } @@ -1236,7 +1236,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()); } } @@ -1269,7 +1269,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 b422b47..423db95 100644 --- a/core/modules/field/field.info.inc +++ b/core/modules/field/field.info.inc @@ -96,7 +96,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 { @@ -134,7 +134,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)); } } @@ -147,7 +147,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.install b/core/modules/field/field.install index 695fd89..5e5b904 100644 --- a/core/modules/field/field.install +++ b/core/modules/field/field.install @@ -161,8 +161,6 @@ function field_schema() { 'deleted' => array('deleted'), ), ); - $schema['cache_field'] = drupal_get_schema_unprocessed('system', 'cache'); - $schema['cache_field']['description'] = 'Cache table for the Field module to store already built field informations.'; return $schema; } diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 3435e73..3fd7247 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -771,7 +771,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/lib/Drupal/field/FieldBundle.php b/core/modules/field/lib/Drupal/field/FieldBundle.php index 9ca3ff9..ea4728f 100644 --- a/core/modules/field/lib/Drupal/field/FieldBundle.php +++ b/core/modules/field/lib/Drupal/field/FieldBundle.php @@ -25,7 +25,6 @@ public function build(ContainerBuilder $container) { ->addArgument('%container.namespaces%'); $container->register('plugin.manager.field.formatter', 'Drupal\field\Plugin\Type\Formatter\FormatterPluginManager') ->addArgument('%container.namespaces%'); - CacheFactory::registerBin($container, 'field'); } } diff --git a/core/modules/field/lib/Drupal/field/FieldInfo.php b/core/modules/field/lib/Drupal/field/FieldInfo.php index 7ff6850..e6981cd 100644 --- a/core/modules/field/lib/Drupal/field/FieldInfo.php +++ b/core/modules/field/lib/Drupal/field/FieldInfo.php @@ -112,7 +112,7 @@ public function flush() { $this->bundleExtraFields = array(); - cache('field')->deleteTags(array('field_info' => TRUE)); + cache('entity')->deleteTags(array('field_info' => TRUE)); } /** @@ -131,7 +131,7 @@ public function getFieldMap() { } // Read from persistent cache. - if ($cached = cache('field')->get('field_info:field_map')) { + if ($cached = cache('entity')->get('field_info:field_map')) { $map = $cached->data; // Save in "static" cache. @@ -157,7 +157,7 @@ public function getFieldMap() { // Save in "static" and persistent caches. $this->fieldMap = $map; - cache('field')->set('field_info:field_map', $map, CacheBackendInterface::CACHE_PERMANENT, array('field_info' => TRUE)); + cache('entity')->set('field_info:field_map', $map, CacheBackendInterface::CACHE_PERMANENT, array('field_info' => TRUE)); return $map; } @@ -175,7 +175,7 @@ public function getFields() { } // Read from persistent cache. - if ($cached = cache('field')->get('field_info:fields')) { + if ($cached = cache('entity')->get('field_info:fields')) { $this->fieldsById = $cached->data; } else { @@ -185,7 +185,7 @@ public function getFields() { } // Store in persistent cache. - cache('field')->set('field_info:fields', $this->fieldsById, CacheBackendInterface::CACHE_PERMANENT, array('field_info' => TRUE)); + cache('entity')->set('field_info:fields', $this->fieldsById, CacheBackendInterface::CACHE_PERMANENT, array('field_info' => TRUE)); } // Fill the name/ID map. @@ -216,7 +216,7 @@ public function getInstances($entity_type = NULL) { if (!$this->loadedAllInstances) { // Read from persistent cache. - if ($cached = cache('field')->get('field_info:instances')) { + if ($cached = cache('entity')->get('field_info:instances')) { $this->bundleInstances = $cached->data; } else { @@ -233,7 +233,7 @@ public function getInstances($entity_type = NULL) { } // Store in persistent cache. - cache('field')->set('field_info:instances', $this->bundleInstances, CacheBackendInterface::CACHE_PERMANENT, array('field_info' => TRUE)); + cache('entity')->set('field_info:instances', $this->bundleInstances, CacheBackendInterface::CACHE_PERMANENT, array('field_info' => TRUE)); } $this->loadedAllInstances = TRUE; @@ -350,7 +350,7 @@ public function getBundleInstances($entity_type, $bundle) { } // Read from the persistent cache. - if ($cached = cache('field')->get("field_info:bundle:$entity_type:$bundle")) { + if ($cached = cache('entity')->get("field_info:bundle:$entity_type:$bundle")) { $info = $cached->data; // Extract the field definitions and save them in the "static" cache. @@ -420,7 +420,7 @@ public function getBundleInstances($entity_type, $bundle) { foreach ($instances as $instance) { $cache['fields'][] = $this->fieldsById[$instance['field_id']]; } - cache('field')->set("field_info:bundle:$entity_type:$bundle", $cache, CacheBackendInterface::CACHE_PERMANENT, array('field_info' => TRUE)); + cache('entity')->set("field_info:bundle:$entity_type:$bundle", $cache, CacheBackendInterface::CACHE_PERMANENT, array('field_info' => TRUE)); return $instances; } @@ -443,7 +443,7 @@ public function getBundleExtraFields($entity_type, $bundle) { } // Read from the persistent cache. - if ($cached = cache('field')->get("field_info:bundle_extra:$entity_type:$bundle")) { + if ($cached = cache('entity')->get("field_info:bundle_extra:$entity_type:$bundle")) { $this->bundleExtraFields[$entity_type][$bundle] = $cached->data; return $this->bundleExtraFields[$entity_type][$bundle]; } @@ -461,7 +461,7 @@ public function getBundleExtraFields($entity_type, $bundle) { // Store in the 'static' and persistent caches. $this->bundleExtraFields[$entity_type][$bundle] = $info; - cache('field')->set("field_info:bundle_extra:$entity_type:$bundle", $info, CacheBackendInterface::CACHE_PERMANENT, array('field_info' => TRUE)); + cache('entity')->set("field_info:bundle_extra:$entity_type:$bundle", $info, CacheBackendInterface::CACHE_PERMANENT, array('field_info' => TRUE)); return $this->bundleExtraFields[$entity_type][$bundle]; } 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.install b/core/modules/filter/filter.install index 536d4f6..45955ad 100644 --- a/core/modules/filter/filter.install +++ b/core/modules/filter/filter.install @@ -8,16 +8,6 @@ use Drupal\Component\Uuid\Uuid; /** - * Implements hook_schema(). - */ -function filter_schema() { - $schema['cache_filter'] = drupal_get_schema_unprocessed('system', 'cache'); - $schema['cache_filter']['description'] = 'Cache table for the Filter module to store already filtered pieces of text, identified by text format and hash of the text.'; - - return $schema; -} - -/** * @addtogroup updates-7.x-to-8.x * @{ */ diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 5de251c..be68773 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -216,7 +216,7 @@ function filter_format_disable($format) { // Clear the filter cache whenever a text format is disabled. filter_formats_reset(); - cache('filter')->deleteTags(array('filter_format' => $format->format)); + cache('render')->deleteTags(array('filter_format' => $format->format)); } /** @@ -709,7 +709,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 @@ -748,7 +748,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; } } @@ -790,7 +790,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/FilterBundle.php b/core/modules/filter/lib/Drupal/filter/FilterBundle.php deleted file mode 100644 index 2c0a460..0000000 --- a/core/modules/filter/lib/Drupal/filter/FilterBundle.php +++ /dev/null @@ -1,26 +0,0 @@ -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.'); - $result = db_query('SELECT * FROM {cache_filter}')->fetchObject(); + $result = db_query('SELECT * FROM {cache_render}')->fetchObject(); $this->assertFalse($result, 'Cache cleared.'); $elements = $this->xpath('//select[@name=:first]/following::select[@name=:second]', array( diff --git a/core/modules/image/image.module b/core/modules/image/image.module index b2816de..a3dc85e 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -778,10 +778,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 880e335..f934f74 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); } @@ -321,7 +321,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..aa6652e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookExitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookExitTest.php @@ -56,12 +56,12 @@ function testHookExit() { // 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/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 dbdf6a5..088ceb9 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1751,7 +1751,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 a93a124..17df338 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -684,12 +684,12 @@ function system_schema() { $schema['cache_bootstrap']['description'] = 'Cache table for data required to bootstrap Drupal, may be routed to a shared memory cache.'; $schema['cache_config'] = $schema['cache']; $schema['cache_config']['description'] = 'Cache table for configuration data.'; - $schema['cache_page'] = $schema['cache']; - $schema['cache_page']['description'] = 'Cache table used to store compressed pages for anonymous users, if page caching is enabled.'; - $schema['cache_menu'] = $schema['cache']; - $schema['cache_menu']['description'] = 'Cache table for the menu system to store router information as well as generated link trees for various menu/page/user combinations.'; + $schema['cache_render'] = $schema['cache']; + $schema['cache_render']['description'] = 'Cache table to store rendered HTML strings.'; + $schema['cache_entity'] = $schema['cache']; + $schema['cache_entity']['description'] = 'Cache table for field and entity caches.'; $schema['cache_path'] = $schema['cache']; - $schema['cache_path']['description'] = 'Cache table for path alias lookup.'; + $schema['cache_path']['description'] = 'Cache table for path-specific (but not HTML strings) caches.'; $schema['flood'] = array( 'description' => 'Flood controls the threshold of events, such as the number of contact attempts.', @@ -2177,6 +2177,19 @@ function system_update_8053() { } /** + * Add new generic cache bins. + */ +function system_update_8054() { + $schema['cache_render'] = drupal_get_schema_unprocessed('system', 'cache'); + $schema['cache_render']['description'] = 'Cache table to store rendered HTML strings.'; + $schema['cache_entity'] = drupal_get_schema_unprocessed('system', 'cache'); + $schema['cache_entity']['description'] = 'Cache table for field and entity caches.'; + foreach ($schema as $name => $definition) { + db_create_table($name, $definition); + } +} + +/** * @} 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/lib/Drupal/views/ViewsBundle.php b/core/modules/views/lib/Drupal/views/ViewsBundle.php index 649fd7d..e0dd2ec 100644 --- a/core/modules/views/lib/Drupal/views/ViewsBundle.php +++ b/core/modules/views/lib/Drupal/views/ViewsBundle.php @@ -38,7 +38,6 @@ public function build(ContainerBuilder $container) { $container->register('views.analyzer', 'Drupal\views\Analyzer') ->addArgument(new Reference('module_handler')); CacheFactory::registerBin($container, 'views_info'); - CacheFactory::registerBin($container, 'views_results'); } } diff --git a/core/modules/views/views.install b/core/modules/views/views.install index 8bda10e..06d2c69 100644 --- a/core/modules/views/views.install +++ b/core/modules/views/views.install @@ -19,11 +19,6 @@ function views_install() { */ function views_schema() { $schema['cache_views_info'] = drupal_get_schema_unprocessed('system', 'cache'); - - $schema['cache_views_results'] = drupal_get_schema_unprocessed('system', 'cache'); - $schema['cache_views_results']['description'] = 'Cache table for views to store pre-rendered queries, results, and display output.'; - $schema['cache_views_results']['fields']['serialized']['default'] = 1; - return $schema; } diff --git a/core/modules/views/views.module b/core/modules/views/views.module index f1cb911..9683e18 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -655,7 +655,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(); + } /** @@ -663,7 +666,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(); } /** @@ -671,7 +676,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(); } /**