API: Cache API help in memcached, inital use of the API log added earlier seems to...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 27 Aug 2009 18:25:51 +0000 (18:25 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 27 Aug 2009 18:25:51 +0000 (18:25 +0000)
includes/api/ApiMain.php

index 825da48..14e7209 100644 (file)
@@ -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();