From adf309bdc8448a5673b332bc40dd3320dfd32198 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 27 Aug 2009 18:25:51 +0000 Subject: [PATCH] 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. --- includes/api/ApiMain.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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(); -- 2.20.1