summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries Buytaert2011-09-11 12:14:18 -0400
committerDries Buytaert2011-09-11 12:14:18 -0400
commit9177c2a11c60b00dc5a468d2e4ef949f88c2bfad (patch)
tree60c93094c32cbb0814aca88c72c8607dbb173def
parentf214431458d1621b3d28068444bd9ff946dc5450 (diff)
- Patch #1272686 by Paul Simard, bfroehle, beejeebus: convert existing cache_* calls to the new cache()-> API.
-rw-r--r--includes/common.inc18
-rw-r--r--includes/form.inc12
-rw-r--r--includes/gettext.inc2
-rw-r--r--includes/menu.inc20
-rw-r--r--includes/module.inc23
-rw-r--r--includes/path.inc4
-rw-r--r--includes/registry.inc4
-rw-r--r--includes/theme.inc6
-rw-r--r--modules/block/block.module4
-rw-r--r--modules/book/book.module10
-rw-r--r--modules/field/field.attach.inc6
-rw-r--r--modules/field/field.info.inc12
-rw-r--r--modules/field/field.module2
-rw-r--r--modules/field/tests/field.test28
-rw-r--r--modules/filter/filter.module20
-rw-r--r--modules/image/image.api.php2
-rw-r--r--modules/image/image.module16
-rw-r--r--modules/locale/locale.admin.inc2
-rw-r--r--modules/locale/locale.module12
-rw-r--r--modules/locale/locale.pages.inc4
-rw-r--r--modules/menu/menu.module4
-rw-r--r--modules/node/node.module6
-rw-r--r--modules/path/path.test8
-rw-r--r--modules/simpletest/drupal_web_test_case.php2
-rw-r--r--modules/simpletest/simpletest.module6
-rw-r--r--modules/simpletest/tests/bootstrap.test2
-rw-r--r--modules/simpletest/tests/cache.test8
-rw-r--r--modules/simpletest/tests/module.test10
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.test4
-rw-r--r--modules/system/system.admin.inc2
-rw-r--r--modules/system/system.module2
-rw-r--r--update.php2
32 files changed, 131 insertions, 132 deletions
diff --git a/includes/common.inc b/includes/common.inc
index e75aa81..bb4d8e7 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -4992,7 +4992,7 @@ function drupal_page_set_cache() {
if (variable_get('page_compression', TRUE) && extension_loaded('zlib')) {
$cache->data['body'] = gzencode($cache->data['body'], 9, FORCE_GZIP);
}
- cache_set($cache->cid, $cache->data, 'cache_page', $cache->expire);
+ cache('page')->set($cache->cid, $cache->data, $cache->expire);
}
return $cache;
}
@@ -5813,7 +5813,7 @@ function drupal_render_cache_get($elements) {
}
$bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'cache';
- if (!empty($cid) && $cache = cache_get($cid, $bin)) {
+ if (!empty($cid) && $cache = cache($bin)->get($cid)) {
// Add additional libraries, JavaScript, CSS and other data attached
// to this element.
if (isset($cache->data['#attached'])) {
@@ -5858,7 +5858,7 @@ function drupal_render_cache_set(&$markup, $elements) {
}
$bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'cache';
$expire = isset($elements['#cache']['expire']) ? $elements['#cache']['expire'] : CACHE_PERMANENT;
- cache_set($cid, $data, $bin, $expire);
+ cache($bin)->set($cid, $data, $expire);
}
/**
@@ -7149,7 +7149,7 @@ function drupal_flush_all_caches() {
$core = array('cache', 'cache_path', 'cache_filter', 'cache_bootstrap', 'cache_page');
$cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
foreach ($cache_tables as $table) {
- cache_clear_all('*', $table, TRUE);
+ cache($table)->flush();
}
// Rebuild the bootstrap module list. We do this here so that developers
@@ -7299,7 +7299,7 @@ function entity_get_info($entity_type = NULL) {
$langcode = $language->language;
if (empty($entity_info)) {
- if ($cache = cache_get("entity_info:$langcode")) {
+ if ($cache = cache()->get("entity_info:$langcode")) {
$entity_info = $cache->data;
}
else {
@@ -7342,7 +7342,7 @@ function entity_get_info($entity_type = NULL) {
}
// Let other modules alter the entity info.
drupal_alter('entity_info', $entity_info);
- cache_set("entity_info:$langcode", $entity_info);
+ cache()->set("entity_info:$langcode", $entity_info);
}
}
@@ -7360,7 +7360,7 @@ function entity_get_info($entity_type = NULL) {
function entity_info_cache_clear() {
drupal_static_reset('entity_get_info');
// Clear all languages.
- cache_clear_all('entity_info:', 'cache', TRUE);
+ cache()->deletePrefix('entity_info:');
}
/**
@@ -7738,13 +7738,13 @@ function archiver_get_info() {
$archiver_info = &drupal_static(__FUNCTION__, array());
if (empty($archiver_info)) {
- $cache = cache_get('archiver_info');
+ $cache = cache()->get('archiver_info');
if ($cache === FALSE) {
// Rebuild the cache and save it.
$archiver_info = module_invoke_all('archiver_info');
drupal_alter('archiver_info', $archiver_info);
uasort($archiver_info, 'drupal_sort_weight');
- cache_set('archiver_info', $archiver_info);
+ cache()->set('archiver_info', $archiver_info);
}
else {
$archiver_info = $cache->data;
diff --git a/includes/form.inc b/includes/form.inc
index 442016a..cfbea38 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -472,12 +472,12 @@ function drupal_rebuild_form($form_id, &$form_state, $old_form = NULL) {
* Fetch a form from cache.
*/
function form_get_cache($form_build_id, &$form_state) {
- if ($cached = cache_get('form_' . $form_build_id, 'cache_form')) {
+ if ($cached = cache('form')->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_get('form_state_' . $form_build_id, 'cache_form')) {
+ if ($cached = cache('form')->get('form_state_' . $form_build_id)) {
// Re-populate $form_state for subsequent rebuilds.
$form_state = $cached->data + $form_state;
@@ -511,12 +511,12 @@ function form_set_cache($form_build_id, $form, $form_state) {
if ($GLOBALS['user']->uid) {
$form['#cache_token'] = drupal_get_token();
}
- cache_set('form_' . $form_build_id, $form, 'cache_form', REQUEST_TIME + $expire);
+ cache('form')->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_set('form_state_' . $form_build_id, $data, 'cache_form', REQUEST_TIME + $expire);
+ cache('form')->set('form_state_' . $form_build_id, $data, REQUEST_TIME + $expire);
}
}
@@ -835,8 +835,8 @@ function drupal_process_form($form_id, &$form, &$form_state) {
// here, as we've finished with them. The in-memory copies are still
// here, though.
if (!variable_get('cache', 0) && !empty($form_state['values']['form_build_id'])) {
- cache_clear_all('form_' . $form_state['values']['form_build_id'], 'cache_form');
- cache_clear_all('form_state_' . $form_state['values']['form_build_id'], 'cache_form');
+ cache('form')->delete('form_' . $form_state['values']['form_build_id']);
+ cache('form')->delete('form_state_' . $form_state['values']['form_build_id']);
}
// If batches were set in the submit handlers, we process them now,
diff --git a/includes/gettext.inc b/includes/gettext.inc
index 39a6fbe..fa9952b 100644
--- a/includes/gettext.inc
+++ b/includes/gettext.inc
@@ -53,7 +53,7 @@ function _locale_import_po($file, $langcode, $mode) {
// Clear cache and force refresh of JavaScript translations.
_locale_invalidate_js($langcode);
- cache_clear_all('locale:', 'cache', TRUE);
+ cache()->deletePrefix('locale:');
// Rebuild the menu, strings may have changed.
menu_rebuild();
diff --git a/includes/menu.inc b/includes/menu.inc
index 3e775db..0e3f5b6 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -441,14 +441,14 @@ function menu_get_item($path = NULL, $router_item = NULL) {
// Since there is no limit to the length of $path, use a hash to keep it
// short yet unique.
$cid = 'menu_item:' . hash('sha256', $path);
- if ($cached = cache_get($cid, 'cache_menu')) {
+ if ($cached = cache('menu')->get($cid)) {
$router_item = $cached->data;
}
else {
$parts = array_slice($original_map, 0, MENU_MAX_PARTS);
$ancestors = menu_get_ancestors($parts);
$router_item = db_query_range('SELECT * FROM {menu_router} WHERE path IN (:ancestors) ORDER BY fit DESC', 0, 1, array(':ancestors' => $ancestors))->fetchAssoc();
- cache_set($cid, $router_item, 'cache_menu');
+ cache('menu')->set($cid, $router_item);
}
if ($router_item) {
// Allow modules to alter the router item before it is translated and
@@ -1095,7 +1095,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_get($cid, 'cache_menu');
+ $cache = cache('menu')->get($cid);
if ($cache && isset($cache->data)) {
// If the cache entry exists, it contains the parameters for
// menu_build_tree().
@@ -1122,7 +1122,7 @@ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) {
}
// Cache the tree building parameters using the page-specific cid.
- cache_set($cid, $tree_parameters, 'cache_menu');
+ cache('menu')->set($cid, $tree_parameters);
}
// Build the tree using the parameters; the resulting tree will be cached
@@ -1179,7 +1179,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_get($cid, 'cache_menu');
+ $cache = cache('menu')->get($cid);
if ($cache && isset($cache->data)) {
// If the cache entry exists, it contains the parameters for
// menu_build_tree().
@@ -1251,7 +1251,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_set($cid, $tree_parameters, 'cache_menu');
+ cache('menu')->set($cid, $tree_parameters);
}
// Build the tree using the parameters; the resulting tree will be cached
@@ -1317,7 +1317,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_get($tree_cid, 'cache_menu');
+ $cache = cache('menu')->get($tree_cid);
if ($cache && isset($cache->data)) {
$trees[$tree_cid] = $cache->data;
}
@@ -1378,7 +1378,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_set($tree_cid, $data, 'cache_menu');
+ cache('menu')->set($tree_cid, $data);
$trees[$tree_cid] = $data;
}
@@ -2512,7 +2512,7 @@ function menu_cache_clear($menu_name = 'navigation') {
$cache_cleared = &drupal_static(__FUNCTION__, array());
if (empty($cache_cleared[$menu_name])) {
- cache_clear_all('links:' . $menu_name . ':', 'cache_menu', TRUE);
+ cache('menu')->deletePrefix('links:' . $menu_name . ':');
$cache_cleared[$menu_name] = 1;
}
elseif ($cache_cleared[$menu_name] == 1) {
@@ -2529,7 +2529,7 @@ function menu_cache_clear($menu_name = 'navigation') {
* might have been made to the router items or menu links.
*/
function menu_cache_clear_all() {
- cache_clear_all('*', 'cache_menu', TRUE);
+ cache('menu')->flush();
menu_reset_static_cache();
}
diff --git a/includes/module.inc b/includes/module.inc
index 66c77f5..cc3aa8e 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -129,12 +129,12 @@ function system_list($type) {
if (isset($lists['bootstrap'])) {
return $lists['bootstrap'];
}
- if ($cached = cache_get('bootstrap_modules', 'cache_bootstrap')) {
+ if ($cached = cache('bootstrap')->get('bootstrap_modules')) {
$bootstrap_list = $cached->data;
}
else {
$bootstrap_list = db_query("SELECT name, filename FROM {system} WHERE status = 1 AND bootstrap = 1 AND type = 'module' ORDER BY weight ASC, name ASC")->fetchAllAssoc('name');
- cache_set('bootstrap_modules', $bootstrap_list, 'cache_bootstrap');
+ cache('bootstrap')->set('bootstrap_modules', $bootstrap_list);
}
// To avoid a separate database lookup for the filepath, prime the
// drupal_get_filename() static cache for bootstrap modules only.
@@ -148,7 +148,7 @@ function system_list($type) {
}
// Otherwise build the list for enabled modules and themes.
elseif (!isset($lists['module_enabled'])) {
- if ($cached = cache_get('system_list', 'cache_bootstrap')) {
+ if ($cached = cache('bootstrap')->get('system_list')) {
$lists = $cached->data;
}
else {
@@ -178,7 +178,7 @@ function system_list($type) {
$lists['filepaths'][] = array('type' => $record->type, 'name' => $record->name, 'filepath' => $record->filename);
}
}
- cache_set('system_list', $lists, 'cache_bootstrap');
+ cache('bootstrap')->set('system_list', $lists);
}
// To avoid a separate database lookup for the filepath, prime the
// drupal_get_filename() static cache with all enabled modules and themes.
@@ -197,8 +197,7 @@ function system_list_reset() {
drupal_static_reset('system_list');
drupal_static_reset('system_rebuild_module_data');
drupal_static_reset('list_themes');
- cache_clear_all('bootstrap_modules', 'cache_bootstrap');
- cache_clear_all('system_list', 'cache_bootstrap');
+ cache('bootstrap')->deleteMultiple(array('bootstrap_modules', 'system_list'));
}
/**
@@ -648,16 +647,16 @@ function module_implements($hook, $sort = FALSE, $reset = FALSE) {
// per request.
if ($reset) {
$implementations = array();
- cache_set('module_implements', array(), 'cache_bootstrap');
+ cache('bootstrap')->set('module_implements', array());
drupal_static_reset('module_hook_info');
drupal_static_reset('drupal_alter');
- cache_clear_all('hook_info', 'cache_bootstrap');
+ cache('bootstrap')->delete('hook_info');
return;
}
// Fetch implementations from cache.
if (empty($implementations)) {
- $implementations = cache_get('module_implements', 'cache_bootstrap');
+ $implementations = cache('bootstrap')->get('module_implements');
if ($implementations === FALSE) {
$implementations = array();
}
@@ -726,7 +725,7 @@ function module_hook_info() {
if (!isset($hook_info)) {
$hook_info = array();
- $cache = cache_get('hook_info', 'cache_bootstrap');
+ $cache = cache('bootstrap')->get('hook_info');
if ($cache === FALSE) {
// Rebuild the cache and save it.
// We can't use module_invoke_all() here or it would cause an infinite
@@ -747,7 +746,7 @@ function module_hook_info() {
$function($hook_info);
}
}
- cache_set('hook_info', $hook_info, 'cache_bootstrap');
+ cache('bootstrap')->set('hook_info', $hook_info);
}
else {
$hook_info = $cache->data;
@@ -769,7 +768,7 @@ function module_implements_write_cache() {
// optimized as tightly, and not doing so keeps the cache entry smaller.
if (isset($implementations['#write_cache']) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD')) {
unset($implementations['#write_cache']);
- cache_set('module_implements', $implementations, 'cache_bootstrap');
+ cache('bootstrap')->set('module_implements', $implementations);
}
}
diff --git a/includes/path.inc b/includes/path.inc
index db60537..630b34c 100644
--- a/includes/path.inc
+++ b/includes/path.inc
@@ -90,7 +90,7 @@ function drupal_lookup_path($action, $path = '', $path_language = NULL) {
$cache['map'][$path_language] = array();
// Load system paths from cache.
$cid = current_path();
- if ($cached = cache_get($cid, 'cache_path')) {
+ if ($cached = cache('path')->get($cid)) {
$cache['system_paths'] = $cached->data;
// Now fetch the aliases corresponding to these system paths.
$args = array(
@@ -212,7 +212,7 @@ function drupal_cache_system_paths() {
if ($paths = current($cache['map'])) {
$data = array_keys($paths);
$expire = REQUEST_TIME + (60 * 60 * 24);
- cache_set($cid, $data, 'cache_path', $expire);
+ cache('path')->set($cid, $data, $expire);
}
}
}
diff --git a/includes/registry.inc b/includes/registry.inc
index 3fb14fb..38bcd16 100644
--- a/includes/registry.inc
+++ b/includes/registry.inc
@@ -83,7 +83,7 @@ function _registry_update() {
$unchanged_resources = array();
$lookup_cache = array();
- if ($cache = cache_get('lookup_cache', 'cache_bootstrap')) {
+ if ($cache = cache('bootstrap')->get('lookup_cache')) {
$lookup_cache = $cache->data;
}
foreach ($lookup_cache as $key => $file) {
@@ -105,7 +105,7 @@ function _registry_update() {
// We have some unchanged resources, warm up the cache - no need to pay
// for looking them up again.
if (count($unchanged_resources) > 0) {
- cache_set('lookup_cache', $unchanged_resources, 'cache_bootstrap');
+ cache('bootstrap')->set('lookup_cache', $unchanged_resources);
}
}
diff --git a/includes/theme.inc b/includes/theme.inc
index 6c2b640..3287073 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -280,7 +280,7 @@ function _theme_registry_callback($callback = NULL, array $arguments = array())
*/
function _theme_load_registry($theme, $base_theme = NULL, $theme_engine = NULL) {
// Check the theme registry cache; if it exists, use it.
- $cache = cache_get("theme_registry:$theme->name", 'cache');
+ $cache = cache()->get("theme_registry:$theme->name");
if (isset($cache->data)) {
$registry = $cache->data;
}
@@ -300,7 +300,7 @@ function _theme_load_registry($theme, $base_theme = NULL, $theme_engine = NULL)
* Write the theme_registry cache into the database.
*/
function _theme_save_registry($theme, $registry) {
- cache_set("theme_registry:$theme->name", $registry);
+ cache()->set("theme_registry:$theme->name", $registry);
}
/**
@@ -309,7 +309,7 @@ function _theme_save_registry($theme, $registry) {
* to add more theme hooks.
*/
function drupal_theme_rebuild() {
- cache_clear_all('theme_registry', 'cache', TRUE);
+ cache()->deletePrefix('theme_registry');
}
/**
diff --git a/modules/block/block.module b/modules/block/block.module
index 40fc646..93c34ae 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -827,7 +827,7 @@ function _block_render_blocks($region_blocks) {
// with node_access modules. We also preserve the submission of forms in
// blocks, by fetching from cache only if the request method is 'GET'
// (or 'HEAD').
- if (!count(module_implements('node_grants')) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') && ($cid = _block_get_cache_id($block)) && ($cache = cache_get($cid, 'cache_block'))) {
+ if (!count(module_implements('node_grants')) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') && ($cid = _block_get_cache_id($block)) && ($cache = cache('block')->get($cid))) {
$array = $cache->data;
}
else {
@@ -838,7 +838,7 @@ function _block_render_blocks($region_blocks) {
drupal_alter(array('block_view', "block_view_{$block->module}_{$block->delta}"), $array, $block);
if (isset($cid)) {
- cache_set($cid, $array, 'cache_block', CACHE_TEMPORARY);
+ cache('block')->set($cid, $array, CACHE_TEMPORARY);
}
}
diff --git a/modules/book/book.module b/modules/book/book.module
index beb1721..6e74d32 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -1262,12 +1262,12 @@ function book_menu_subtree_data($link) {
$cid = 'links:' . $link['menu_name'] . ':subtree-cid:' . $link['mlid'];
if (!isset($tree[$cid])) {
- $cache = cache_get($cid, 'cache_menu');
+ $cache = cache('menu')->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_get($cache->data, 'cache_menu');
+ $cache = cache('menu')->get($cache->data);
if ($cache && isset($cache->data)) {
$data = $cache->data;
@@ -1300,11 +1300,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_get($tree_cid, 'cache_menu')) {
- cache_set($tree_cid, $data, 'cache_menu');
+ if (!cache('menu')->get($tree_cid)) {
+ cache('menu')->set($tree_cid, $data);
}
// Cache the cid of the (shared) data using the menu and item-specific cid.
- cache_set($cid, $tree_cid, 'cache_menu');
+ cache('menu')->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/modules/field/field.attach.inc b/modules/field/field.attach.inc
index 2419201..c643e40 100644
--- a/modules/field/field.attach.inc
+++ b/modules/field/field.attach.inc
@@ -710,7 +710,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_set($cid, $data, 'cache_field');
+ cache('field')->set($cid, $data);
}
}
}
@@ -984,7 +984,7 @@ function field_attach_update($entity_type, $entity) {
$entity_info = entity_get_info($entity_type);
if ($entity_info['field cache']) {
- cache_clear_all("field:$entity_type:$id", 'cache_field');
+ cache('field')->delete("field:$entity_type:$id");
}
}
@@ -1021,7 +1021,7 @@ function field_attach_delete($entity_type, $entity) {
$entity_info = entity_get_info($entity_type);
if ($entity_info['field cache']) {
- cache_clear_all("field:$entity_type:$id", 'cache_field');
+ cache('field')->delete("field:$entity_type:$id");
}
}
diff --git a/modules/field/field.info.inc b/modules/field/field.info.inc
index 6b172dd..cc8dac5 100644
--- a/modules/field/field.info.inc
+++ b/modules/field/field.info.inc
@@ -76,12 +76,12 @@ function _field_info_collate_types($reset = FALSE) {
if ($reset) {
$info = NULL;
// Clear all languages.
- cache_clear_all('field_info_types:', 'cache_field', TRUE);
+ cache('field')->deletePrefix('field_info_types:');
return;
}
if (!isset($info)) {
- if ($cached = cache_get("field_info_types:$langcode", 'cache_field')) {
+ if ($cached = cache('field')->get("field_info_types:$langcode")) {
$info = $cached->data;
}
else {
@@ -149,7 +149,7 @@ function _field_info_collate_types($reset = FALSE) {
}
drupal_alter('field_storage_info', $info['storage types']);
- cache_set("field_info_types:$langcode", $info, 'cache_field');
+ cache('field')->set("field_info_types:$langcode", $info);
}
}
@@ -181,12 +181,12 @@ function _field_info_collate_fields($reset = FALSE) {
if ($reset) {
$info = NULL;
- cache_clear_all('field_info_fields', 'cache_field');
+ cache('field')->delete('field_info_fields');
return;
}
if (!isset($info)) {
- if ($cached = cache_get('field_info_fields', 'cache_field')) {
+ if ($cached = cache('field')->get('field_info_fields')) {
$info = $cached->data;
}
else {
@@ -238,7 +238,7 @@ function _field_info_collate_fields($reset = FALSE) {
}
}
- cache_set('field_info_fields', $info, 'cache_field');
+ cache('field')->set('field_info_fields', $info);
}
}
diff --git a/modules/field/field.module b/modules/field/field.module
index 30166bd..9683c02 100644
--- a/modules/field/field.module
+++ b/modules/field/field.module
@@ -772,7 +772,7 @@ function _field_extra_fields_pre_render($elements) {
* Clear the field info and field data caches.
*/
function field_cache_clear() {
- cache_clear_all('*', 'cache_field', TRUE);
+ cache('field')->flush();
field_info_cache_clear();
}
diff --git a/modules/field/tests/field.test b/modules/field/tests/field.test
index 669fc37..b361637 100644
--- a/modules/field/tests/field.test
+++ b/modules/field/tests/field.test
@@ -824,18 +824,18 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
$cid = "field:$entity_type:{$entity_init->ftid}";
// Check that no initial cache entry is present.
- $this->assertFalse(cache_get($cid, 'cache_field'), t('Non-cached: no initial cache entry'));
+ $this->assertFalse(cache('field')->get($cid), t('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_get($cid, 'cache_field'), t('Non-cached: no cache entry on insert'));
+ $this->assertFalse(cache('field')->get($cid), t('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_get($cid, 'cache_field'), t('Non-cached: no cache entry on load'));
+ $this->assertFalse(cache('field')->get($cid), t('Non-cached: no cache entry on load'));
// Cacheable entity type.
@@ -846,24 +846,24 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
field_create_instance($instance);
// Check that no initial cache entry is present.
- $this->assertFalse(cache_get($cid, 'cache_field'), t('Cached: no initial cache entry'));
+ $this->assertFalse(cache('field')->get($cid), t('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_get($cid, 'cache_field'), t('Cached: no cache entry on insert'));
+ $this->assertFalse(cache('field')->get($cid), t('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_get($cid, 'cache_field');
- $this->assertFalse(cache_get($cid, 'cache_field'), t('Cached: no cache entry on loading a single field'));
+ $cache = cache('field')->get($cid);
+ $this->assertFalse(cache('field')->get($cid), t('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_get($cid, 'cache_field');
+ $cache = cache('field')->get($cid);
$this->assertEqual($cache->data[$this->field_name][$langcode], $values, t('Cached: correct cache entry on load'));
// Update with different values, and check that the cache entry is wiped.
@@ -871,12 +871,12 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
$entity->{$this->field_name}[$langcode] = $values;
field_attach_update($entity_type, $entity);
- $this->assertFalse(cache_get($cid, 'cache_field'), t('Cached: no cache entry on update'));
+ $this->assertFalse(cache('field')->get($cid), t('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_get($cid, 'cache_field');
+ $cache = cache('field')->get($cid);
$this->assertEqual($cache->data[$this->field_name][$langcode], $values, t('Cached: correct cache entry on load'));
// Create a new revision, and check that the cache entry is wiped.
@@ -885,18 +885,18 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
$entity->{$this->field_name}[$langcode] = $values;
field_attach_update($entity_type, $entity);
- $cache = cache_get($cid, 'cache_field');
- $this->assertFalse(cache_get($cid, 'cache_field'), t('Cached: no cache entry on new revision creation'));
+ $cache = cache('field')->get($cid);
+ $this->assertFalse(cache('field')->get($cid), t('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_get($cid, 'cache_field');
+ $cache = cache('field')->get($cid);
$this->assertEqual($cache->data[$this->field_name][$langcode], $values, t('Cached: correct cache entry on load'));
// Delete, and check that the cache entry is wiped.
field_attach_delete($entity_type, $entity);
- $this->assertFalse(cache_get($cid, 'cache_field'), t('Cached: no cache entry after delete'));
+ $this->assertFalse(cache('field')->get($cid), t('Cached: no cache entry after delete'));
}
/**
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 9e14812..a3f787e 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -260,7 +260,7 @@ function filter_format_save($format) {
$return = SAVED_UPDATED;
// Clear the filter cache whenever a text format is updated.
- cache_clear_all($format->format . ':', 'cache_filter', TRUE);
+ cache('filter')->deletePrefix($format->format . ':');
}
filter_formats_reset();
@@ -290,7 +290,7 @@ function filter_format_disable($format) {
// Clear the filter cache whenever a text format is disabled.
filter_formats_reset();
- cache_clear_all($format->format . ':', 'cache_filter', TRUE);
+ cache('filter')->deletePrefix($format->format . ':');
}
/**
@@ -395,7 +395,7 @@ function filter_formats($account = NULL) {
// All available formats are cached for performance.
if (!isset($formats['all'])) {
- if ($cache = cache_get("filter_formats:{$language->language}")) {
+ if ($cache = cache()->get("filter_formats:{$language->language}")) {
$formats['all'] = $cache->data;
}
else {
@@ -407,7 +407,7 @@ function filter_formats($account = NULL) {
->execute()
->fetchAllAssoc('format');
- cache_set("filter_formats:{$language->language}", $formats['all']);
+ cache()->set("filter_formats:{$language->language}", $formats['all']);
}
}
@@ -430,8 +430,8 @@ function filter_formats($account = NULL) {
* @see filter_formats()
*/
function filter_formats_reset() {
- cache_clear_all('filter_formats', 'cache', TRUE);
- cache_clear_all('filter_list_format', 'cache', TRUE);
+ cache()->deletePrefix('filter_formats');
+ cache()->deletePrefix('filter_list_format');
drupal_static_reset('filter_list_format');
drupal_static_reset('filter_formats');
}
@@ -657,7 +657,7 @@ function filter_list_format($format_id) {
$filter_info = filter_get_filters();
if (!isset($filters['all'])) {
- if ($cache = cache_get('filter_list_format')) {
+ if ($cache = cache()->get('filter_list_format')) {
$filters['all'] = $cache->data;
}
else {
@@ -665,7 +665,7 @@ function filter_list_format($format_id) {
foreach ($result as $record) {
$filters['all'][$record->format][$record->name] = $record;
}
- cache_set('filter_list_format', $filters['all']);
+ cache()->set('filter_list_format', $filters['all']);
}
}
@@ -731,7 +731,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_get($cache_id, 'cache_filter')) {
+ if ($cached = cache('filter')->get($cache_id)) {
return $cached->data;
}
}
@@ -765,7 +765,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_set($cache_id, $text, 'cache_filter');
+ cache('filter')->set($cache_id, $text);
}
return $text;
diff --git a/modules/image/image.api.php b/modules/image/image.api.php
index acb3f9c..52490c3 100644
--- a/modules/image/image.api.php
+++ b/modules/image/image.api.php
@@ -110,7 +110,7 @@ function hook_image_style_delete($style) {
*/
function hook_image_style_flush($style) {
// Empty cached data that contains information about the style.
- cache_clear_all('*', 'cache_mymodule', TRUE);
+ cache('mymodule')->flush();
}
/**
diff --git a/modules/image/image.module b/modules/image/image.module
index 008a365..1f42073 100644
--- a/modules/image/image.module
+++ b/modules/image/image.module
@@ -492,7 +492,7 @@ function image_styles() {
// Grab from cache or build the array.
if (!isset($styles)) {
- if ($cache = cache_get('image_styles', 'cache')) {
+ if ($cache = cache()->get('image_styles')) {
$styles = $cache->data;
}
else {
@@ -534,7 +534,7 @@ function image_styles() {
}
drupal_alter('image_styles', $styles);
- cache_set('image_styles', $styles);
+ cache()->set('image_styles', $styles);
}
}
@@ -827,8 +827,8 @@ function image_style_flush($style) {
module_invoke_all('image_style_flush', $style);
// Clear image style and effect caches.
- cache_clear_all('image_styles', 'cache');
- cache_clear_all('image_effects:', 'cache', TRUE);
+ cache()->delete('image_styles');
+ cache()->deletePrefix('image_effects:');
drupal_static_reset('image_styles');
drupal_static_reset('image_effects');
@@ -838,9 +838,9 @@ function image_style_flush($style) {
// Clear page caches when flushing.
if (module_exists('block')) {
- cache_clear_all('*', 'cache_block', TRUE);
+ cache('block')->flush();
}
- cache_clear_all('*', 'cache_page', TRUE);
+ cache('page')->flush();
}
/**
@@ -952,7 +952,7 @@ function image_effect_definitions() {
$effects = &drupal_static(__FUNCTION__);
if (!isset($effects)) {
- if ($cache = cache_get("image_effects:$langcode") && !empty($cache->data)) {
+ if ($cache = cache()->get("image_effects:$langcode") && !empty($cache->data)) {
$effects = $cache->data;
}
else {
@@ -969,7 +969,7 @@ function image_effect_definitions() {
}
uasort($effects, '_image_effect_definitions_sort');
drupal_alter('image_effect_info', $effects);
- cache_set("image_effects:$langcode", $effects);
+ cache()->set("image_effects:$langcode", $effects);
}
}
diff --git a/modules/locale/locale.admin.inc b/modules/locale/locale.admin.inc
index ecf9f1f..cd2edf5 100644
--- a/modules/locale/locale.admin.inc
+++ b/modules/locale/locale.admin.inc
@@ -168,7 +168,7 @@ function locale_languages_overview_form_submit($form, &$form_state) {
drupal_set_message(t('Configuration saved.'));
// Changing the language settings impacts the interface.
- cache_clear_all('*', 'cache_page', TRUE);
+ cache('page')->flush();
module_invoke_all('multilingual_settings_changed');
$form_state['redirect'] = 'admin/config/regional/language';
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index ba66999..4a15ed9 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -638,7 +638,7 @@ function locale($string = NULL, $context = NULL, $langcode = NULL) {
// perspective that is a really bad idea, so we have no user
// interface for this. Be careful when turning this option off!
if (variable_get('locale_cache_strings', 1) == 1) {
- if ($cache = cache_get('locale:' . $langcode, 'cache')) {
+ if ($cache = cache()->get('locale:' . $langcode)) {
$locale_t[$langcode] = $cache->data;
}
elseif (lock_acquire('locale_cache_' . $langcode)) {
@@ -649,7 +649,7 @@ function locale($string = NULL, $context = NULL, $langcode = NULL) {
foreach ($result as $data) {
$locale_t[$langcode][$data->context][$data->source] = (empty($data->translation) ? TRUE : $data->translation);
}
- cache_set('locale:' . $langcode, $locale_t[$langcode]);
+ cache()->set('locale:' . $langcode, $locale_t[$langcode]);
lock_release('locale_cache_' . $langcode);
}
}
@@ -677,7 +677,7 @@ function locale($string = NULL, $context = NULL, $langcode = NULL) {
->fields(array('version' => VERSION))
->condition('lid', $translation->lid)
->execute();
- cache_clear_all('locale:', 'cache', TRUE);
+ cache()->deletePrefix('locale:');
}
}
else {
@@ -692,7 +692,7 @@ function locale($string = NULL, $context = NULL, $langcode = NULL) {
->execute();
$locale_t[$langcode][$context][$string] = TRUE;
// Clear locale cache so this string can be added in a later request.
- cache_clear_all('locale:', 'cache', TRUE);
+ cache()->deletePrefix('locale:');
}
}
@@ -811,10 +811,10 @@ function locale_language_delete($langcode) {
_locale_invalidate_js($language->language);
// Changing the language settings impacts the interface:
- cache_clear_all('*', 'cache_page', TRUE);
+ cache('page')->flush();
// Clearing all locale cache from database
- cache_clear_all('locale:' . $language->language, 'cache');
+ cache()->delete('locale:' . $language->language);
$variables = array('%locale' => $language->name);
watchdog('locale', 'The language %locale has been removed.', $variables);
diff --git a/modules/locale/locale.pages.inc b/modules/locale/locale.pages.inc
index 45816b9..3e6590e 100644
--- a/modules/locale/locale.pages.inc
+++ b/modules/locale/locale.pages.inc
@@ -410,7 +410,7 @@ function locale_translate_edit_form_submit($form, &$form_state) {
// Clear locale cache.
_locale_invalidate_js();
- cache_clear_all('locale:', 'cache', TRUE);
+ cache()->deletePrefix('locale:');
$form_state['redirect'] = 'admin/config/regional/translate/translate';
return;
@@ -450,7 +450,7 @@ function locale_translate_delete_form_submit($form, &$form_state) {
->execute();
// Force JavaScript translation file recreation for all languages.
_locale_invalidate_js();
- cache_clear_all('locale:', 'cache', TRUE);
+ cache()->deletePrefix('locale:');
drupal_set_message(t('The string has been removed.'));
$form_state['redirect'] = 'admin/config/regional/translate/translate';
}
diff --git a/modules/menu/menu.module b/modules/menu/menu.module
index 2540797..fa58373 100644
--- a/modules/menu/menu.module
+++ b/modules/menu/menu.module
@@ -230,12 +230,12 @@ function menu_load($menu_name) {
function menu_load_all() {
$custom_menus = &drupal_static(__FUNCTION__);
if (!isset($custom_menus)) {
- if ($cached = cache_get('menu_custom', 'cache_menu')) {
+ if ($cached = cache('menu')->get('menu_custom')) {
$custom_menus = $cached->data;
}
else {
$custom_menus = db_query('SELECT * FROM {menu_custom}')->fetchAllAssoc('menu_name', PDO::FETCH_ASSOC);
- cache_set('menu_custom', $custom_menus, 'cache_menu');
+ cache('menu')->set('menu_custom', $custom_menus);
}
}
return $custom_menus;
diff --git a/modules/node/node.module b/modules/node/node.module
index 13b8e4d..92c6795 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -675,7 +675,7 @@ function _node_types_build($rebuild = FALSE) {
if (isset($_node_types)) {
return $_node_types;
}
- if ($cache = cache_get($cid)) {
+ if ($cache = cache()->get($cid)) {
$_node_types = $cache->data;
return $_node_types;
}
@@ -737,7 +737,7 @@ function _node_types_build($rebuild = FALSE) {
asort($_node_types->names);
- cache_set($cid, $_node_types);
+ cache()->set($cid, $_node_types);
return $_node_types;
}
@@ -746,7 +746,7 @@ function _node_types_build($rebuild = FALSE) {
* Clears the node type cache.
*/
function node_type_cache_reset() {
- cache_clear_all('node_types:', 'cache', TRUE);
+ cache()->deletePrefix('node_types:');
drupal_static_reset('_node_types_build');
}
diff --git a/modules/path/path.test b/modules/path/path.test
index 9e50178..241f532 100644
--- a/modules/path/path.test
+++ b/modules/path/path.test
@@ -37,14 +37,14 @@ class PathTestCase extends DrupalWebTestCase {
// Visit the system path for the node and confirm a cache entry is
// created.
- cache_clear_all('*', 'cache_path', TRUE);
+ cache('path')->flush();
$this->drupalGet($edit['source']);
- $this->assertTrue(cache_get($edit['source'], 'cache_path'), t('Cache entry was created.'));
+ $this->assertTrue(cache('path')->get($edit['source']), t('Cache entry was created.'));
// Visit the alias for the node and confirm a cache entry is created.
- cache_clear_all('*', 'cache_path', TRUE);
+ cache('path')->flush();
$this->drupalGet($edit['alias']);
- $this->assertTrue(cache_get($edit['source'], 'cache_path'), t('Cache entry was created.'));
+ $this->assertTrue(cache('path')->get($edit['source']), t('Cache entry was created.'));
}
/**
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index b2a7bf1..3ce06d5 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -1435,7 +1435,7 @@ class DrupalWebTestCase extends DrupalTestCase {
*/
protected function refreshVariables() {
global $conf;
- cache_clear_all('variables', 'cache_bootstrap');
+ cache('bootstrap')->delete('variables');
$conf = variable_initialize();
}
diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module
index ede9ac6..80a6bc5 100644
--- a/modules/simpletest/simpletest.module
+++ b/modules/simpletest/simpletest.module
@@ -311,7 +311,7 @@ function simpletest_test_get_all() {
if (!$groups) {
// Load test information from cache if available, otherwise retrieve the
// information from each tests getInfo() method.
- if ($cache = cache_get('simpletest', 'cache')) {
+ if ($cache = cache()->get('simpletest')) {
$groups = $cache->data;
}
else {
@@ -347,7 +347,7 @@ function simpletest_test_get_all() {
// Allow modules extending core tests to disable originals.
drupal_alter('simpletest', $groups);
- cache_set('simpletest', $groups);
+ cache()->set('simpletest', $groups);
}
}
return $groups;
@@ -421,7 +421,7 @@ function simpletest_clean_environment() {
// Detect test classes that have been added, renamed or deleted.
registry_rebuild();
- cache_clear_all('simpletest', 'cache');
+ cache()->delete('simpletest');
}
/**
diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test
index 14c16a9..d1e9662 100644
--- a/modules/simpletest/tests/bootstrap.test
+++ b/modules/simpletest/tests/bootstrap.test
@@ -306,7 +306,7 @@ class HookBootExitTestCase extends DrupalWebTestCase {
// Boot and exit should not fire since the page is cached.
variable_set('page_cache_invoke_hooks', FALSE);
- $this->assertTrue(cache_get(url('', array('absolute' => TRUE)), 'cache_page'), t('Page has been cached.'));
+ $this->assertTrue(cache('page')->get(url('', array('absolute' => TRUE))), t('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, t('hook_boot not called with agressive 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, t('hook_exit not called with agressive cache and a cached page.'));
diff --git a/modules/simpletest/tests/cache.test b/modules/simpletest/tests/cache.test
index 1235269..1f3240d 100644
--- a/modules/simpletest/tests/cache.test
+++ b/modules/simpletest/tests/cache.test
@@ -314,16 +314,16 @@ class CacheClearCase extends CacheTestCase {
$bins = array('cache', 'filter', 'page', 'bootstrap', 'path');
$bins = array_merge(module_invoke_all('flush_caches'), $bins);
foreach ($bins as $id => $bin) {
- $id = 'test_cid_clear' . $id;
- cache_set($id, $this->default_value, $bin);
+ $cid = 'test_cid_clear' . $id;
+ cache($bin)->set($cid, $this->default_value);
}
// Remove all caches then make sure that they are cleared.
drupal_flush_all_caches();
foreach ($bins as $id => $bin) {
- $id = 'test_cid_clear' . $id;
- $this->assertFalse($this->checkCacheExists($id, $this->default_value, $bin), t('All cache entries removed from @bin.', array('@bin' => $bin)));
+ $cid = 'test_cid_clear' . $id;
+ $this->assertFalse($this->checkCacheExists($cid, $this->default_value, $bin), t('All cache entries removed from @bin.', array('@bin' => $bin)));
}
}
}
diff --git a/modules/simpletest/tests/module.test b/modules/simpletest/tests/module.test
index f55c08a..c9601c9 100644
--- a/modules/simpletest/tests/module.test
+++ b/modules/simpletest/tests/module.test
@@ -86,17 +86,17 @@ class ModuleUnitTest extends DrupalWebTestCase {
*/
function testModuleImplements() {
// Clear the cache.
- cache_clear_all('module_implements', 'cache_bootstrap');
- $this->assertFalse(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is empty.'));
+ cache('bootstrap')->delete('module_implements');
+ $this->assertFalse(cache('bootstrap')->get('module_implements'), t('The module implements cache is empty.'));
$this->drupalGet('');
- $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is populated after requesting a page.'));
+ $this->assertTrue(cache('bootstrap')->get('module_implements'), t('The module implements cache is populated after requesting a page.'));
// Test again with an authenticated user.
$this->user = $this->drupalCreateUser();
$this->drupalLogin($this->user);
- cache_clear_all('module_implements', 'cache_bootstrap');
+ cache('bootstrap')->delete('module_implements');
$this->drupalGet('');
- $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is populated after requesting a page.'));
+ $this->assertTrue(cache('bootstrap')->get('module_implements'), t('The module implements cache is populated after requesting a page.'));
// Make sure group include files are detected properly even when the file is
// already loaded when the cache is rebuilt.
diff --git a/modules/simpletest/tests/upgrade/upgrade.test b/modules/simpletest/tests/upgrade/upgrade.test
index 1ef8525..9326f25 100644
--- a/modules/simpletest/tests/upgrade/upgrade.test
+++ b/modules/simpletest/tests/upgrade/upgrade.test
@@ -204,8 +204,8 @@ abstract class UpgradePathTestCase extends DrupalWebTestCase {
->execute();
try {
- cache_clear_all('variables', 'cache');
- cache_clear_all('variables', 'cache_bootstrap');
+ cache()->delete('variables');
+ cache('bootstrap')->delete('variables');
}
// Since cache_bootstrap won't exist in a Drupal 6 site, ignore the
// exception if the above fails.
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index baac6f7..6824f19 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -1734,7 +1734,7 @@ function system_clear_cache_submit($form, &$form_state) {
* @ingroup forms
*/
function system_clear_page_cache_submit($form, &$form_state) {
- cache_clear_all('*', 'cache_page', TRUE);
+ cache('page')->flush();
}
/**
diff --git a/modules/system/system.module b/modules/system/system.module
index 3737af1..cfab0a9 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -3007,7 +3007,7 @@ function system_cron() {
$core = array('cache', 'cache_path', 'cache_filter', 'cache_page', 'cache_form', 'cache_menu');
$cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
foreach ($cache_tables as $table) {
- cache_clear_all(NULL, $table);
+ cache($table)->expire();
}
// Cleanup the batch table and the queue for failed batches.
diff --git a/update.php b/update.php
index 105bc9d..b759436 100644
--- a/update.php
+++ b/update.php
@@ -231,7 +231,7 @@ function update_info_page() {
_drupal_flush_css_js();
// Flush the cache of all data for the update status module.
if (db_table_exists('cache_update')) {
- cache_clear_all('*', 'cache_update', TRUE);
+ cache('update')->flush();
}
update_task_list('info');