Skip to content

Instantly share code, notes, and snippets.

@martinmev
Created October 8, 2017 22:09
Show Gist options
  • Save martinmev/66e70eab423bfc4381da6ad479cdba93 to your computer and use it in GitHub Desktop.
Save martinmev/66e70eab423bfc4381da6ad479cdba93 to your computer and use it in GitHub Desktop.
Patch for Drupal6 (and Pressflow6 too) cache
diff --git a/www/includes/cache.inc b/www/includes/cache.inc
index 1e70960..d08f3f4 100644
--- a/www/includes/cache.inc
+++ b/www/includes/cache.inc
@@ -17,9 +17,9 @@ function cache_get($cid, $table = 'cache') {
// Garbage collection necessary when enforcing a minimum cache lifetime
$cache_flush = variable_get('cache_flush_'. $table, 0);
- if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= time())) {
+ if ($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);
+ variable_set('cache_flush_'. $table, time());
// Time to flush old cache data
db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment