From: Tim Starling Date: Sun, 27 Mar 2005 17:26:55 +0000 (+0000) Subject: Don't clear objectcache on every query, I doubt there was any good reason for doing so X-Git-Tag: 1.5.0alpha1~482 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=0cc1d7fd548078e14bb60d003865aa11dc595186;p=lhc%2Fweb%2Fwiklou.git Don't clear objectcache on every query, I doubt there was any good reason for doing so --- 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(); + } } }