From cacd5e1fbba920147339e65a2086c9d4f76507ab Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 23 Dec 2008 19:45:57 +0000 Subject: [PATCH] Revert r44804 "Store negative [interwiki] results in cache" Caching negative results for a long period would be extremely annoying when adding a new prefix and discovering it doesn't work. Negative cache needs to either be much, much shorter or have a clear easy way to purge it. --- includes/Interwiki.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/includes/Interwiki.php b/includes/Interwiki.php index 1cd96b52b5..3522fadb14 100644 --- a/includes/Interwiki.php +++ b/includes/Interwiki.php @@ -143,27 +143,24 @@ class Interwiki { $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, $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, $wgInterwikiExpiry ); } + return false; } -- 2.20.1