diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-29 11:36:06 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-29 11:36:06 +0000 |
commit | 8aeab150eb97474e8ba6f9f5c71903a1f5f024bc (patch) | |
tree | bcae69d8361f8d450e56a7d8020c6f77e838758d | |
parent | 1909326e1b58ca80fd336c0fd27d54e164edd3d1 (diff) | |
download | brdo-8aeab150eb97474e8ba6f9f5c71903a1f5f024bc.tar.gz brdo-8aeab150eb97474e8ba6f9f5c71903a1f5f024bc.tar.bz2 |
#215252 by bdragon: reset the cache flush variable before the cache is flushed, so busy sites will not attempt multiple cache flushes at a time
-rw-r--r-- | includes/cache.inc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/includes/cache.inc b/includes/cache.inc index 521f36f99..9fe7602c0 100644 --- a/includes/cache.inc +++ b/includes/cache.inc @@ -17,9 +17,10 @@ function cache_get($cid, $table = 'cache') { // Garbage collection necessary when enforcing a minimum cache lifetime $cache_flush = variable_get('cache_flush', 0); 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', 0); // Time to flush old cache data db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush); - variable_set('cache_flush', 0); } $cache = db_fetch_object(db_query("SELECT data, created, headers, expire, serialized FROM {". $table ."} WHERE cid = '%s'", $cid)); |