r56091 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56090‎ | r56091 | r56092 >
Date:12:54, 9 September 2009
Author:catrope
Status:ok (Comments)
Tags:todo 
Comment:
Follow-up to r55639: per CR comment, make API help caching disableable, and let the cache key depend on the version string
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiMain.php
@@ -555,15 +555,19 @@
556556 * Override the parent to generate help messages for all available modules.
557557 */
558558 public function makeHelpMsg() {
559 - global $wgMemc;
 559+ global $wgMemc, $wgAPICacheHelp;
560560 $this->mPrinter->setHelp();
561561 // Get help text from cache if present
562 - $key = wfMemcKey( 'apihelp', $this->getModuleName() );
563 - $cached = $wgMemc->get( $key );
564 - if ( $cached )
565 - return $cached;
 562+ $key = wfMemcKey( 'apihelp', $this->getModuleName(),
 563+ SpecialVersion::getVersion( 'nodb' ) );
 564+ if ( $wgAPICacheHelp ) {
 565+ $cached = $wgMemc->get( $key );
 566+ if ( $cached )
 567+ return $cached;
 568+ }
566569 $retval = $this->reallyMakeHelpMsg();
567 - $wgMemc->set( $key, $retval, 60*60 );
 570+ if ( $wgAPICacheHelp )
 571+ $wgMemc->set( $key, $retval, 60*60 );
568572 return $retval;
569573 }
570574
Index: trunk/phase3/includes/DefaultSettings.php
@@ -3846,6 +3846,12 @@
38473847 $wgAPIRequestLog = false;
38483848
38493849 /**
 3850+ * Cache the API help text for up to an hour. Disable this during API
 3851+ * debugging and development
 3852+ */
 3853+$wgAPICacheHelp = true;
 3854+
 3855+/**
38503856 * Parser test suite files to be run by parserTests.php when no specific
38513857 * filename is passed to it.
38523858 *

Follow-up revisions

RevisionCommit summaryAuthorDate
r56531Fix r56091: cache URLs with and without ?version separatelycatrope15:47, 17 September 2009
r56559API: Per CR comments on r56091, make the timeout for the API help cache confi...catrope19:39, 17 September 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r55639API: Cache API help in memcached, inital use of the API log added earlier see...catrope18:25, 27 August 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   19:12, 10 September 2009

Would recommend making the config var the cache timeout rather than just an on/off.

Looks like the caching will still fail to update if you're enabling and disabling extensions, or doing any development that doesn't alter the reported MediaWiki version.

Status & tagging log