r16549 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r16548‎ | r16549 | r16550 >
Date:18:10, 18 September 2006
Author:brion
Status:old
Tags:
Comment:
* Added experimental $wgRevisionCacheExpiry to cache extracted revision text
in $wgMemc, to further reduce hits to external storage.
Set to 0 (disabled) by default.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -2716,7 +2716,7 @@
27172717 if ( !$argsOnly ) {
27182718 $braceCallbacks[2] = array( &$this, 'braceSubstitution' );
27192719 }
2720 - if ( !$this->mOutputType != OT_MSG ) {
 2720+ if ( $this->mOutputType != OT_MSG ) {
27212721 $braceCallbacks[3] = array( &$this, 'argSubstitution' );
27222722 }
27232723 if ( $braceCallbacks ) {
Index: trunk/phase3/includes/Revision.php
@@ -672,6 +672,17 @@
673673 $fname = 'Revision::loadText';
674674 wfProfileIn( $fname );
675675
 676+ // Caching may be beneficial for massive use of external storage
 677+ global $wgRevisionCacheExpiry, $wgMemc, $wgDBname;
 678+ $key = "$wgDBname:revisiontext:textid:" . $this->getTextId();
 679+ if( $wgRevisionCacheExpiry ) {
 680+ $text = $wgMemc->get( $key );
 681+ if( is_string( $text ) ) {
 682+ wfProfileOut( $fname );
 683+ return $text;
 684+ }
 685+ }
 686+
676687 // If we kept data for lazy extraction, use it now...
677688 $row = $this->mTextRow;
678689 $this->mTextRow = null;
@@ -695,6 +706,11 @@
696707 }
697708
698709 $text = Revision::getRevisionText( $row );
 710+
 711+ if( $wgRevisionCacheExpiry ) {
 712+ $wgMemc->set( $key, $text, $wgRevisionCacheExpiry );
 713+ }
 714+
699715 wfProfileOut( $fname );
700716
701717 return $text;
Index: trunk/phase3/includes/DefaultSettings.php
@@ -2071,6 +2071,14 @@
20722072 $wgDefaultExternalStore = false;
20732073
20742074 /**
 2075+ * Revision text may be cached in $wgMemc to reduce load on external storage
 2076+ * servers and object extraction overhead for frequently-loaded revisions.
 2077+ *
 2078+ * Set to 0 to disable, or number of seconds before cache expiry.
 2079+ */
 2080+$wgRevisionCacheExpiry = 0;
 2081+
 2082+/**
20752083 * list of trusted media-types and mime types.
20762084 * Use the MEDIATYPE_xxx constants to represent media types.
20772085 * This list is used by Image::isSafeFile
Index: trunk/phase3/RELEASE-NOTES
@@ -210,6 +210,9 @@
211211 for page titles which shouldn't be converted on display/linking
212212 * Lazy extraction of text chunks in Revision objects, may reduce hits to
213213 external storage when actual text content is not used
 214+* Added experimental $wgRevisionCacheExpiry to cache extracted revision text
 215+ in $wgMemc, to further reduce hits to external storage.
 216+ Set to 0 (disabled) by default.
214217
215218
216219 == Languages updated ==