diff options
author | Tim Starling <tstarling@users.mediawiki.org> | 2005-03-27 17:26:55 +0000 |
---|---|---|
committer | Tim Starling <tstarling@users.mediawiki.org> | 2005-03-27 17:26:55 +0000 |
commit | 0cc1d7fd548078e14bb60d003865aa11dc595186 (patch) | |
tree | 3612eb83a6e42a3cb66cd2cdd5da5ad13c7f3803 /includes/ObjectCache.php | |
parent | 9d4d4b7779473c45da6a98880181fd76c8a0cd10 (diff) | |
download | mediawikicore-0cc1d7fd548078e14bb60d003865aa11dc595186.tar.gz mediawikicore-0cc1d7fd548078e14bb60d003865aa11dc595186.zip |
Don't clear objectcache on every query, I doubt there was any good reason for doing so
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/7943
Diffstat (limited to 'includes/ObjectCache.php')
-rw-r--r-- | includes/ObjectCache.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/includes/ObjectCache.php b/includes/ObjectCache.php index b4bb22b59e3b..78ca5110b536 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(); + } } } |