Revert "[LanguageConverter] Added some cache code based on the problems in r97512."
authorBrion VIBBER <brion@wikimedia.org>
Fri, 6 Apr 2012 18:41:27 +0000 (18:41 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 6 Apr 2012 18:41:27 +0000 (18:41 +0000)
This reverts commit 3b8dbbd502b68d373b74481ed2bead7413050c83 -- merged prematurely, needs add'l discussion

includes/DefaultSettings.php
languages/LanguageConverter.php

index 0c19810..8402d69 100644 (file)
@@ -1636,13 +1636,6 @@ $wgMemCachedTimeout = 100000;
  */
 $wgUseLocalMessageCache = false;
 
-/**
- * Make LanguageConverter use a different cache type.
- * Possible values are false (none), 'main' ($wgMemc), and 'apc'.
- * @since 1.20
- */
-$wgLanguageConverterCacheType = 'main';
-
 /**
  * Defines format of local cache
  * true - Serialized object
@@ -4229,7 +4222,7 @@ $wgParserTestFiles = array(
  * );
  */
 $wgParserTestRemote = false;
-
 /**
  * Allow running of javascript test suites via [[Special:JavaScriptTest]] (such as QUnit).
  */
index 3997d7f..2b9cc8e 100644 (file)
@@ -813,13 +813,13 @@ class LanguageConverter {
                if ( $this->mTablesLoaded ) {
                        return;
                }
-
+               global $wgMemc;
                wfProfileIn( __METHOD__ );
                $this->mTablesLoaded = true;
                $this->mTables = false;
                if ( $fromCache ) {
                        wfProfileIn( __METHOD__ . '-cache' );
-                       $this->mTables = $this->cacheFetch( $this->mCacheKey );
+                       $this->mTables = $wgMemc->get( $this->mCacheKey );
                        wfProfileOut( __METHOD__ . '-cache' );
                }
                if ( !$this->mTables
@@ -837,48 +837,12 @@ class LanguageConverter {
                        $this->postLoadTables();
                        $this->mTables[self::CACHE_VERSION_KEY] = true;
 
-                       $this->cacheStore( $this->mCacheKey, $this->mTables, 43200 );
+                       $wgMemc->set( $this->mCacheKey, $this->mTables, 43200 );
                        wfProfileOut( __METHOD__ . '-recache' );
                }
                wfProfileOut( __METHOD__ );
        }
 
-       /**
-        * Read an object from the cache
-        * @param $key string
-        * @return mixed
-        */
-       protected function cacheFetch( $key ) {
-               global $wgLanguageConverterCacheType, $wgMemc;
-
-               if ( $wgLanguageConverterCacheType === 'apc' ) {
-                       return apc_fetch( $key );
-               } elseif ( $wgLanguageConverterCacheType === 'main' ) {
-                       return $wgMemc->get( $key );
-               }
-
-               return false; // disabled
-       }
-
-       /**
-        * Store an object into the cache
-        * @param $key string
-        * @param $val mixed
-        * @param $ttl integer Seconds to live
-        * @return bool Success
-        */
-       protected function cacheStore( $key, $val, $ttl ) {
-               global $wgLanguageConverterCacheType, $wgMemc;
-
-               if ( $wgLanguageConverterCacheType === 'apc' ) {
-                       return apc_store( $key, $val, $ttl );
-               } elseif ( $wgLanguageConverterCacheType === 'main' ) {
-                       return $wgMemc->set( $key, $val, $ttl );
-               }
-
-               return true; // disabled
-       }
-
        /**
         * Hook for post processing after conversion tables are loaded.
         */