r55639 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55638‎ | r55639 | r55640 >
Date:18:25, 27 August 2009
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
API: Cache API help in memcached, inital use of the API log added earlier seems to indicate that the help is expensive. Cache doesn't seem to help for me locally, so we probably need to test this on a real server and see if it really works.
Modified paths:
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiMain.php
@@ -546,6 +546,19 @@
547547 * Override the parent to generate help messages for all available modules.
548548 */
549549 public function makeHelpMsg() {
 550+ global $wgMemc;
 551+ $this->mPrinter->setHelp();
 552+ // Get help text from cache if present
 553+ $key = wfMemcKey( 'apihelp', $this->getModuleName() );
 554+ $cached = $wgMemc->get( $key );
 555+ if ( $cached )
 556+ return $cached;
 557+ $retval = $this->reallyMakeHelpMsg();
 558+ $wgMemc->set( $key, $retval, 60*60 );
 559+ return $retval;
 560+ }
 561+
 562+ public function reallyMakeHelpMsg() {
550563
551564 $this->mPrinter->setHelp();
552565

Follow-up revisions

RevisionCommit summaryAuthorDate
r56091Follow-up to r55639: per CR comment, make API help caching disableable, and l...catrope12:54, 9 September 2009

Comments

#Comment by Catrope (talk | contribs)   18:30, 27 August 2009

Per testing on prototype, this really does work

#Comment by Brion VIBBER (talk | contribs)   23:59, 8 September 2009

This looks like it'll cache the entire help page for up to 1 hour, which I can imagine would be a bit confusing when switching around configuration options, enabling/disabling extensions, or writing new code that adds or changes modules.

This needs either a good way to auto-expire the cache when something changes, or a much shorter default timeout (and possibly a way to override it).

Status & tagging log