--- cache.inc 2010-03-16 21:39:26.000000000 -0400 +++ cache.inc.orig 2010-03-16 11:42:30.000000000 -0400 @@ -1,25 +1,6 @@ -10 AND expire != %d AND expire <= %d", -time(), CACHE_PERMANENT, $cache_flush); - // But delete those that are older than one hour - db_query("DELETE FROM {". $table ."} WHERE created <= -10 AND created > %d AND expire != %d AND expire <= %d", -(time() - (60 * 60)),CACHE_PERMANENT, $cache_flush); - } -} - /** * Return data from the persistent cache. Data may be stored as either plain text or as serialized data. * cache_get will automatically return unserialized objects and arrays. @@ -38,7 +19,8 @@ if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= time())) { // Reset the variable immediately to prevent a meltdown in heavy load situations. variable_set('cache_flush_'. $table, 0); - delete_not_permanent($table,$cache_flush); + // Time to flush old cache data + db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush); } $cache = db_fetch_object(db_query("SELECT data, created, headers, expire, serialized FROM {". $table ."} WHERE cid = '%s'", $cid)); @@ -58,10 +40,6 @@ // sess_read() in session.inc. else { if ($user->cache > $cache->created) { - if ($table == 'cache_page') { - // To avoid too many people updating the page, temporarily set the created time 10 seconds in the future - db_query("UPDATE {".$table."} SET created = ".(time() + 10)." WHERE cid='%s'",$cid); - } // This cache data is too old and thus not valid for us, ignore it. return 0; } @@ -179,25 +157,19 @@ else if (time() > ($cache_flush + variable_get('cache_lifetime', 0))) { // Clear the cache for everyone, cache_lifetime seconds have // passed since the first request to clear the cache. - delete_not_permanent($table,time()); - // db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); + db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); variable_set('cache_flush_'. $table, 0); } } else { // No minimum cache lifetime, flush all temporary cache entries now. - delete_not_permanent($table,time()); - // db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); + db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); } } else { if ($wildcard) { if ($cid == '*') { - if ($table != 'cache_page'){ - db_query("TRUNCATE TABLE {". $table ."}"); - } else { - delete_not_permanent($table,time()); - } + db_query("TRUNCATE TABLE {". $table ."}"); } else { db_query("DELETE FROM {". $table ."} WHERE cid LIKE '%s%%'", $cid);