diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 91ca349..57d9196 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -1079,7 +1079,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 b13c3bc..94ccc2f 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -4880,7 +4880,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/form.inc b/core/includes/form.inc index b26966f..dca8f98 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -500,12 +500,12 @@ function drupal_rebuild_form($form_id, &$form_state, $old_form = NULL) { * Fetches a form from the cache. */ function form_get_cache($form_build_id, &$form_state) { - if ($cached = cache('form')->get('form_' . $form_build_id)) { + if ($cached = cache('path')->get('form_' . $form_build_id)) { $form = $cached->data; global $user; if ((isset($form['#cache_token']) && drupal_valid_token($form['#cache_token'])) || (!isset($form['#cache_token']) && !$user->uid)) { - if ($cached = cache('form')->get('form_state_' . $form_build_id)) { + if ($cached = cache('path')->get('form_state_' . $form_build_id)) { // Re-populate $form_state for subsequent rebuilds. $form_state = $cached->data + $form_state; @@ -539,12 +539,12 @@ function form_set_cache($form_build_id, $form, $form_state) { if ($GLOBALS['user']->uid) { $form['#cache_token'] = drupal_get_token(); } - cache('form')->set('form_' . $form_build_id, $form, REQUEST_TIME + $expire); + cache('path')->set('form_' . $form_build_id, $form, REQUEST_TIME + $expire); } // Cache form state. if ($data = array_diff_key($form_state, array_flip(form_state_keys_no_cache()))) { - cache('form')->set('form_state_' . $form_build_id, $data, REQUEST_TIME + $expire); + cache('path')->set('form_state_' . $form_build_id, $data, REQUEST_TIME + $expire); } } @@ -882,8 +882,8 @@ function drupal_process_form($form_id, &$form, &$form_state) { // here, though. $config = config('system.performance'); if (!$config->get('cache.page.enabled') && !empty($form_state['values']['form_build_id'])) { - cache('form')->delete('form_' . $form_state['values']['form_build_id']); - cache('form')->delete('form_state_' . $form_state['values']['form_build_id']); + cache('path')->delete('form_' . $form_state['values']['form_build_id']); + cache('path')->delete('form_state_' . $form_state['values']['form_build_id']); } // If batches were set in the submit handlers, we process them now, diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 6492b10..9071492 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -1084,7 +1084,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(). @@ -1111,7 +1111,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 @@ -1211,7 +1211,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(). @@ -1284,7 +1284,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 @@ -1353,7 +1353,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; } @@ -1421,7 +1421,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; } @@ -2617,7 +2617,7 @@ function menu_link_load($mlid) { * 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(); } @@ -2629,7 +2629,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 d4a40a8..c43c71c 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.install b/core/modules/block/block.install index a5bd3c4..9c6f151 100644 --- a/core/modules/block/block.install +++ b/core/modules/block/block.install @@ -202,10 +202,6 @@ function block_schema() { ), 'primary key' => array('module', 'delta', 'type', 'langcode'), ); - - $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; } diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 26bcb25..2126bfd 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -373,7 +373,7 @@ function _block_get_renderable_region($list = array()) { '#cache' => array( 'keys' => array($block->module, $block->delta), 'granularity' => $block->cache, - 'bin' => 'block', + 'bin' => 'render', 'tags' => array('content' => TRUE), ), ); @@ -953,13 +953,6 @@ function _block_get_renderable_block($element) { } /** - * Implements hook_cache_flush(). - */ -function block_cache_flush() { - return array('block'); -} - -/** * Implements hook_rebuild(). */ function block_rebuild() { diff --git a/core/modules/book/book.module b/core/modules/book/book.module index f606e48..f266bf7 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -1374,12 +1374,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; @@ -1412,11 +1412,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 29ebd3b..5b2c6af 100644 --- a/core/modules/field/field.attach.inc +++ b/core/modules/field/field.attach.inc @@ -926,7 +926,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) { @@ -1002,7 +1002,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); } } } @@ -1276,7 +1276,7 @@ function field_attach_update($entity_type, EntityInterface $entity) { $entity_info = entity_get_info($entity_type); if ($entity_info['field_cache']) { - cache('field')->delete("field:$entity_type:" . $entity->id()); + cache('entity')->delete("field:$entity_type:" . $entity->id()); } } @@ -1311,7 +1311,7 @@ function field_attach_delete($entity_type, $entity) { $entity_info = entity_get_info($entity_type); if ($entity_info['field_cache']) { - cache('field')->delete("field:$entity_type:" . $entity->id()); + cache('entity')->delete("field:$entity_type:" . $entity->id()); } } diff --git a/core/modules/field/field.info.inc b/core/modules/field/field.info.inc index 5fab889..18228b3 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 b88faa8..b35e16a 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 487878f..bff053a 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -467,14 +467,6 @@ function field_language_fallback(&$field_langcodes, $entity, $langcode) { } /** - * Implements hook_cache_flush(). - */ -function field_cache_flush() { - // Request a flush of our cache table. - return array('field'); -} - -/** * Implements hook_rebuild(). */ function field_rebuild() { @@ -794,7 +786,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/FieldInfo.php b/core/modules/field/lib/Drupal/field/FieldInfo.php index 65fce21..f3d4837 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 f971099..93f0a13 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php @@ -246,18 +246,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_type, $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. @@ -268,24 +268,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_type, $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. @@ -293,12 +293,12 @@ function testFieldAttachCache() { $entity = clone($entity_init); $entity->{$this->field_name}[$langcode] = $values; field_attach_update($entity_type, $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. @@ -307,18 +307,18 @@ function testFieldAttachCache() { $entity = clone($entity_init); $entity->{$this->field_name}[$langcode] = $values; field_attach_update($entity_type, $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_type, $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 f11a528..1a32b8c 100644 --- a/core/modules/filter/filter.api.php +++ b/core/modules/filter/filter.api.php @@ -194,9 +194,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. @@ -227,9 +227,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 f3c29a5..3ba1222 100644 --- a/core/modules/filter/filter.install +++ b/core/modules/filter/filter.install @@ -104,10 +104,6 @@ function filter_schema() { 'status_weight' => array('status', 'weight'), ), ); - - $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; } diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 1aff070..0c9a31a 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -29,13 +29,6 @@ const FILTER_TYPE_TRANSFORM_IRREVERSIBLE = 3; /** - * Implements hook_cache_flush(). - */ -function filter_cache_flush() { - return array('filter'); -} - -/** * Implements hook_help(). */ function filter_help($path, $arg) { @@ -310,7 +303,7 @@ function filter_format_save($format) { $return = SAVED_UPDATED; // Clear the filter cache whenever a text format is updated. - cache('filter')->deleteTags(array('filter_format' => $format->format)); + cache('render')->deleteTags(array('filter_format' => $format->format)); } filter_formats_reset(); @@ -340,7 +333,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)); } /** @@ -810,7 +803,7 @@ function filter_list_format($format_id) { * English. This allows filters to be language aware so language specific * text replacement can be implemented. * @param $cache - * Boolean whether to cache the filtered output in the {cache_filter} table. + * Boolean whether to cache the filtered output in the {cache_render} table. * The caller may set this to FALSE when the output is already cached * elsewhere to avoid duplicate cache lookups and storage. * @param array $filter_types_to_skip @@ -849,7 +842,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; } } @@ -891,7 +884,7 @@ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE, // automatically flushed when the text format is updated. // @see filter_format_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/Tests/FilterAdminTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php index 9a09a76..80e44b3 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php @@ -129,7 +129,7 @@ function testFilterAdmin() { $this->drupalPost('admin/config/content/formats/' . $filtered, $edit, t('Save configuration')); $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 221e07c..a893d97 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -834,10 +834,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 9777811..c06ae09 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -295,7 +295,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); } @@ -306,7 +306,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/menu/menu.module b/core/modules/menu/menu.module index e9080fd..21563a4 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -234,12 +234,12 @@ function menu_load($menu_name) { function menu_load_all() { $custom_menus = &drupal_static(__FUNCTION__); if (!isset($custom_menus)) { - if ($cached = cache('menu')->get('menu_custom')) { + if ($cached = cache('path')->get('menu_custom')) { $custom_menus = $cached->data; } else { $custom_menus = db_query('SELECT * FROM {menu_custom}')->fetchAllAssoc('menu_name', PDO::FETCH_ASSOC); - cache('menu')->set('menu_custom', $custom_menus); + cache('path')->set('menu_custom', $custom_menus); } } return $custom_menus; diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookBootExitTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookBootExitTest.php index e9eff7a..b6684e7 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookBootExitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookBootExitTest.php @@ -53,13 +53,13 @@ function testHookBootExit() { // Boot and exit should not fire since the 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_boot'))->fetchField(), $calls, 'hook_boot not called with aggressive cache and a cached page.'); $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, boot and 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_boot'))->fetchField(), $calls, 'hook_boot 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 5820202..ca4911d 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; } @@ -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 a5194f7..2b7575c 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1715,7 +1715,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 ac70335..14705bf 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -669,14 +669,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_form'] = $schema['cache']; - $schema['cache_form']['description'] = 'Cache table for the form system to store recently built forms and their storage data, to be used in subsequent page requests.'; - $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['date_format_type'] = array( 'description' => 'Stores configured date format types.', @@ -2150,6 +2148,7 @@ function system_update_8025() { } /** +<<<<<<< HEAD * Cleans up javascript_parsed variable. * * @ingroup system_upgrade @@ -2359,6 +2358,18 @@ function system_update_8044() { '404_fast_paths' => 'paths', '404_fast_paths_exclude' => 'exclude_paths', )); +======= + * Add new generic cache bins. + */ +function system_update_8026() { + $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); + } +>>>>>>> added start of update function. } /** diff --git a/core/modules/system/system.module b/core/modules/system/system.module index eaaebc2..5eed0ee 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -3463,7 +3463,7 @@ function system_cron() { // Cleanup the flood. drupal_container()->get('flood')->garbageCollection(); - $cache_bins = array_merge(module_invoke_all('cache_flush'), array('form', 'menu')); + $cache_bins = module_invoke_all('cache_flush'); foreach ($cache_bins as $bin) { cache($bin)->deleteExpired(); } @@ -3492,8 +3492,7 @@ function system_cron() { * Implements hook_cache_flush(). */ function system_cache_flush() { - // Do NOT flush the 'form' cache bin to retain in-progress form submissions. - return array('bootstrap', 'config', 'cache', 'page', 'path'); + return array('bootstrap', 'config', 'cache', 'render', 'entity', 'path'); } /**