Apply changes made live on Wikimedia cluster related to preprocessor caching to subve...
[lhc/web/wiklou.git] / includes / Interwiki.php
index abcef1f..3522fad 100644 (file)
@@ -139,31 +139,28 @@ class Interwiki {
         *
         */
        protected static function load( $prefix ) {
-               global $wgMemc;
+               global $wgMemc, $wgInterwikiExpiry;
                $key = wfMemcKey( 'interwiki', $prefix );
                $mc = $wgMemc->get( $key );
                $iw = false;
-               if( $mc && is_array( $mc ) ) { // is_array is hack for old keys
+               if( $mc && is_array( $mc ) ){ // is_array is hack for old keys
                        $iw = Interwiki::loadFromArray( $mc );
                        if( $iw ){
                                return $iw;
                        }
-               } else if( $mc === 0 ) {
-                       return false; // negative result cached
                }
+               
                $db = wfGetDB( DB_SLAVE );
+                       
                $row = $db->fetchRow( $db->select( 'interwiki', '*', array( 'iw_prefix' => $prefix ),
                        __METHOD__ ) );
                $iw = Interwiki::loadFromArray( $row );
-               if( $iw ) {
+               if ( $iw ) {
                        $mc = array( 'iw_url' => $iw->mURL, 'iw_local' => $iw->mLocal, 'iw_trans' => $iw->mTrans );
-                       $wgMemc->add( $key, $mc );
+                       $wgMemc->add( $key, $mc, $wgInterwikiExpiry );
                        return $iw;
-               } else {
-                       # Pages like "Command & Conquer 3: Kane's Wrath" may keep checking
-                       # the prefix. Cache the negative result to avoid extra db hits.
-                       $wgMemc->add( $key, 0 );
                }
+               
                return false;
        }