From 0cc1d7fd548078e14bb60d003865aa11dc595186 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sun, 27 Mar 2005 17:26:55 +0000 Subject: [PATCH] Don't clear objectcache on every query, I doubt there was any good reason for doing so --- includes/ObjectCache.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/ObjectCache.php b/includes/ObjectCache.php index b4bb22b59e..78ca5110b5 100644 --- a/includes/ObjectCache.php +++ b/includes/ObjectCache.php @@ -315,11 +315,14 @@ class SqlBagOStuff extends BagOStuff { } function garbageCollect() { - $nowtime = time(); - /* Avoid repeating the delete within a few seconds */ - if ( $nowtime > ($this->lastexpireall + 1) ) { - $this->lastexpireall = $nowtime; - $this->expireall(); + /* Ignore 99% of requests */ + if ( !mt_rand( 0, 100 ) ) { + $nowtime = time(); + /* Avoid repeating the delete within a few seconds */ + if ( $nowtime > ($this->lastexpireall + 1) ) { + $this->lastexpireall = $nowtime; + $this->expireall(); + } } } -- 2.20.1