From: Roan Kattouw Date: Thu, 27 Aug 2009 18:25:51 +0000 (+0000) Subject: API: Cache API help in memcached, inital use of the API log added earlier seems to... X-Git-Tag: 1.31.0-rc.0~40025 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=adf309bdc8448a5673b332bc40dd3320dfd32198;p=lhc%2Fweb%2Fwiklou.git 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. --- diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 825da48d9a..14e720964f 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -546,6 +546,19 @@ class ApiMain extends ApiBase { * Override the parent to generate help messages for all available modules. */ public function makeHelpMsg() { + global $wgMemc; + $this->mPrinter->setHelp(); + // Get help text from cache if present + $key = wfMemcKey( 'apihelp', $this->getModuleName() ); + $cached = $wgMemc->get( $key ); + if ( $cached ) + return $cached; + $retval = $this->reallyMakeHelpMsg(); + $wgMemc->set( $key, $retval, 60*60 ); + return $retval; + } + + public function reallyMakeHelpMsg() { $this->mPrinter->setHelp();