TemplateParser: Use ObjectCache::newAccelerator() with fallback set
authorKunal Mehta <legoktm@gmail.com>
Mon, 23 Mar 2015 03:17:43 +0000 (20:17 -0700)
committerKrinkle <krinklemail@gmail.com>
Mon, 23 Mar 2015 03:34:57 +0000 (03:34 +0000)
Change-Id: I202192f6bf509068941e9490d02a11bdedecd872

includes/TemplateParser.php

index b105ca4..3de70fa 100644 (file)
@@ -103,11 +103,7 @@ class TemplateParser {
                        // See if the compiled PHP code is stored in cache.
                        // CACHE_ACCEL throws an exception if no suitable object cache is present, so fall
                        // back to CACHE_ANYTHING.
-                       try {
-                               $cache = wfGetCache( CACHE_ACCEL );
-                       } catch ( Exception $e ) {
-                               $cache = wfGetCache( CACHE_ANYTHING );
-                       }
+                       $cache = ObjectCache::newAccelerator( array(), CACHE_ANYTHING );
                        $key = wfMemcKey( 'template', $templateName, $fastHash );
                        $code = $this->forceRecompile ? null : $cache->get( $key );