Index: trunk/phase3/includes/Interwiki.php |
— | — | @@ -143,24 +143,27 @@ |
144 | 144 | $key = wfMemcKey( 'interwiki', $prefix ); |
145 | 145 | $mc = $wgMemc->get( $key ); |
146 | 146 | $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 |
148 | 148 | $iw = Interwiki::loadFromArray( $mc ); |
149 | 149 | if( $iw ){ |
150 | 150 | return $iw; |
151 | 151 | } |
| 152 | + } else if( $mc === 0 ) { |
| 153 | + return false; // negative result cached |
152 | 154 | } |
153 | | - |
154 | 155 | $db = wfGetDB( DB_SLAVE ); |
155 | | - |
156 | 156 | $row = $db->fetchRow( $db->select( 'interwiki', '*', array( 'iw_prefix' => $prefix ), |
157 | 157 | __METHOD__ ) ); |
158 | 158 | $iw = Interwiki::loadFromArray( $row ); |
159 | | - if ( $iw ) { |
| 159 | + if( $iw ) { |
160 | 160 | $mc = array( 'iw_url' => $iw->mURL, 'iw_local' => $iw->mLocal, 'iw_trans' => $iw->mTrans ); |
161 | 161 | $wgMemc->add( $key, $mc ); |
162 | 162 | 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 ); |
163 | 167 | } |
164 | | - |
165 | 168 | return false; |
166 | 169 | } |
167 | 170 | |