Merge "Don't fallback from uk to ru"
[lhc/web/wiklou.git] / includes / cache / FileCacheBase.php
index 5632596..e25f882 100644 (file)
@@ -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() );
        }
 
        /**