X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fcache%2FFileCacheBase.php;h=e25f882b378f30e797520c4b49446f0ebd0c84e5;hb=9de4779e206628d8c7c9ae76785bfe825b5267d5;hp=5632596a435b2c0b8d3b6c9383e715d42a39130d;hpb=536a06e64303f1cc8f44b197d8dc7423cda959a6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/FileCacheBase.php b/includes/cache/FileCacheBase.php index 5632596a43..e25f882b37 100644 --- a/includes/cache/FileCacheBase.php +++ b/includes/cache/FileCacheBase.php @@ -157,12 +157,6 @@ abstract class FileCacheBase { * @return string Compressed text */ public function saveText( $text ) { - global $wgUseFileCache; - - if ( !$wgUseFileCache ) { - return false; - } - if ( $this->useGzip() ) { $text = gzencode( $text ); } @@ -235,8 +229,8 @@ abstract class FileCacheBase { * @return void */ public function incrMissesRecent( WebRequest $request ) { - global $wgMemc; if ( mt_rand( 0, self::MISS_FACTOR - 1 ) == 0 ) { + $cache = ObjectCache::getLocalClusterInstance(); # Get a large IP range that should include the user even if that # person's IP address changes $ip = $request->getIP(); @@ -249,17 +243,17 @@ abstract class FileCacheBase { # Bail out if a request already came from this range... $key = wfMemcKey( get_class( $this ), 'attempt', $this->mType, $this->mKey, $ip ); - if ( $wgMemc->get( $key ) ) { + if ( $cache->get( $key ) ) { return; // possibly the same user } - $wgMemc->set( $key, 1, self::MISS_TTL_SEC ); + $cache->set( $key, 1, self::MISS_TTL_SEC ); # Increment the number of cache misses... $key = $this->cacheMissKey(); - if ( $wgMemc->get( $key ) === false ) { - $wgMemc->set( $key, 1, self::MISS_TTL_SEC ); + if ( $cache->get( $key ) === false ) { + $cache->set( $key, 1, self::MISS_TTL_SEC ); } else { - $wgMemc->incr( $key ); + $cache->incr( $key ); } } } @@ -269,9 +263,9 @@ abstract class FileCacheBase { * @return int */ public function getMissesRecent() { - global $wgMemc; + $cache = ObjectCache::getLocalClusterInstance(); - return self::MISS_FACTOR * $wgMemc->get( $this->cacheMissKey() ); + return self::MISS_FACTOR * $cache->get( $this->cacheMissKey() ); } /**