Index: trunk/extensions/Cite/Cite_body.php |
— | — | @@ -360,12 +360,28 @@ |
361 | 361 | $prefix = wfMsgForContentNoTrans( 'cite_references_prefix' ); |
362 | 362 | $suffix = wfMsgForContentNoTrans( 'cite_references_suffix' ); |
363 | 363 | $content = implode( "\n", $ent ); |
| 364 | + |
| 365 | + // Let's try to cache it. |
| 366 | + $parserInput = $prefix . $content . $suffix; |
| 367 | + global $wgMemc; |
| 368 | + $cacheKey = wfMemcKey( 'citeref', md5($parserInput), $this->mParser->Title()->getArticleID() ); |
| 369 | + |
| 370 | + wfProfileOut( __METHOD__ .'-entries' ); |
| 371 | + |
| 372 | + wfProfileIn( __METHOD__.'-cache-get' ); |
| 373 | + $ret = $wgMemc->get( $cacheKey ); |
| 374 | + wfProfileOut( __METHOD__.'-cache' ); |
364 | 375 | |
365 | | - wfProfileOut( __METHOD__ .'-entries' ); |
366 | | - wfProfileIn( __METHOD__ .'-parse' ); |
367 | | - // Live hack: parse() adds two newlines on WM, can't reproduce it locally -ævar |
368 | | - $ret = rtrim( $this->parse( $prefix . $content . $suffix ), "\n" ); |
369 | | - wfProfileOut( __METHOD__ .'-parse' ); |
| 376 | + if ( !$ret ) { |
| 377 | + wfProfileIn( __METHOD__ .'-parse' ); |
| 378 | + |
| 379 | + // Live hack: parse() adds two newlines on WM, can't reproduce it locally -ævar |
| 380 | + $ret = rtrim( $this->parse( $parserInput ), "\n" ); |
| 381 | + $wgMemc->set( $cacheKey, $ret, 86400 ); |
| 382 | + |
| 383 | + wfProfileOut( __METHOD__ .'-parse' ); |
| 384 | + } |
| 385 | + |
370 | 386 | wfProfileOut( __METHOD__ ); |
371 | 387 | |
372 | 388 | //done, clean up so we can reuse the group |