Commit a7ea630b authored by jeremy's avatar jeremy

Bug #292346: properly invalidate cache_page when cache_clear_all() called.

parent 831816ab
......@@ -152,13 +152,17 @@ function cache_set($cid, $table = 'cache', $data, $expire = CACHE_PERMANENT, $he
* Expire data from the cache. If called without arguments, expirable
* entries will be cleared from the cache_page table.
*
* Memcache logic is simpler than the core cache because memcache doesn't have
* a minimum cache lifetime consideration (it handles it internally), and
* doesn't support wildcards. Wildcard flushes result in the entire table
* being flushed.
*
* @param $cid
* If set, the cache ID to delete. Otherwise, all cache entries that can
* expire are deleted.
* expire are deleted from the specified table.
*
* @param $table
* If set, the table $table to delete from. Mandatory
* argument if $cid is set.
* If set, the table delete from.
*
* @param $wildcard
* If set to TRUE, the $cid is treated as a substring
......@@ -168,10 +172,11 @@ function cache_set($cid, $table = 'cache', $data, $expire = CACHE_PERMANENT, $he
function cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE) {
global $user;
$bin = empty($table) ? 'cache' : $table;
// Memcache logic is simpler because memcache doesn't have a minimum cache
// lifetime consideration (it handles it internally), and doesn't support
// wildcards.
if (!isset($cid) && !isset($table)) {
$cid = '*';
$wildcard = TRUE;
$table = 'cache_page';
}
if (empty($cid) || ($cid == '*' && $wildcard !== TRUE)) {
# don't do anything if cid is unset. this matches the default drupal behavior...
if ($wildcard && $cid != '*') {
......@@ -188,11 +193,6 @@ function cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE) {
dmemcache_delete($cid, $table);
}
if (!isset($cid) && !isset($table)) {
cache_clear_all('*', 'cache_page', TRUE);
return;
}
if (empty($cid)) {
if (variable_get('cache_lifetime', 0)) {
// We store the time in the current user's $user->cache variable which
......
......@@ -66,13 +66,17 @@ function cache_set($cid, $table = 'cache', $data, $expire = CACHE_PERMANENT, $he
* Expire data from the cache. If called without arguments, expirable
* entries will be cleared from the cache_page table.
*
* Memcache logic is simpler than the core cache because memcache doesn't have
* a minimum cache lifetime consideration (it handles it internally), and
* doesn't support wildcards. Wildcard flushes result in the entire table
* being flushed.
*
* @param $cid
* If set, the cache ID to delete. Otherwise, all cache entries that can
* expire are deleted.
* expire are deleted from the specified table.
*
* @param $table
* If set, the table $table to delete from. Mandatory
* argument if $cid is set.
* If set, the table to delete from.
*
* @param $wildcard
* If set to TRUE, the $cid is treated as a substring
......@@ -80,10 +84,12 @@ function cache_set($cid, $table = 'cache', $data, $expire = CACHE_PERMANENT, $he
* match. If '*' is given as $cid, the table $table will be emptied.
*/
function cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE) {
// Memcache logic is simpler because memcache doesn't have a minimum cache
// lifetime consideration (it handles it internally), and doesn't support
// wildcards.
$bin = empty($table) ? 'cache' : $table;
// If cid and table are not set, we should flush the cache_page table.
if (!isset($cid) && !isset($table)) {
$cid = '*';
$wildcard = TRUE;
$table = 'cache_page';
}
if (empty($cid) || ($cid == '*' && $wildcard !== TRUE)) {
// don't do anything if cid is unset. this matches the default drupal behavior...
if ($wildcard && $cid != '*') {
......
......@@ -9,7 +9,7 @@ function memcache_admin_menu($may_cache) {
'path' => 'admin/settings/memcache',
'callback' => 'memcache_admin_stats',
'title' => t('Memcache'),
'type' => MENU_LOCAL_TASK,
//'type' => MENU_LOCAL_TASK,
'access' => user_access('access memcache statistics'),
'description' => t("View the statistics for this site's memcache and generate new settings."),
);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment