r44964 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44963‎ | r44964 | r44965 >
Date:19:45, 23 December 2008
Author:brion
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/Interwiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Interwiki.php
@@ -143,27 +143,24 @@
144144 $key = wfMemcKey( 'interwiki', $prefix );
145145 $mc = $wgMemc->get( $key );
146146 $iw = false;
147 - if( $mc && is_array( $mc ) ) { // is_array is hack for old keys
 147+ if( $mc && is_array( $mc ) ){ // is_array is hack for old keys
148148 $iw = Interwiki::loadFromArray( $mc );
149149 if( $iw ){
150150 return $iw;
151151 }
152 - } else if( $mc === 0 ) {
153 - return false; // negative result cached
154152 }
 153+
155154 $db = wfGetDB( DB_SLAVE );
 155+
156156 $row = $db->fetchRow( $db->select( 'interwiki', '*', array( 'iw_prefix' => $prefix ),
157157 __METHOD__ ) );
158158 $iw = Interwiki::loadFromArray( $row );
159 - if( $iw ) {
 159+ if ( $iw ) {
160160 $mc = array( 'iw_url' => $iw->mURL, 'iw_local' => $iw->mLocal, 'iw_trans' => $iw->mTrans );
161161 $wgMemc->add( $key, $mc, $wgInterwikiExpiry );
162162 return $iw;
163 - } else {
164 - # Pages like "Command & Conquer 3: Kane's Wrath" may keep checking
165 - # the prefix. Cache the negative result to avoid extra db hits.
166 - $wgMemc->add( $key, 0, $wgInterwikiExpiry );
167163 }
 164+
168165 return false;
169166 }
170167

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r44804Store negative results in cacheaaron14:51, 19 December 2008

Status & tagging log