Update ResourceLoader for Ib7fc2f939b
authorOri Livneh <ori@wikimedia.org>
Mon, 19 Oct 2015 17:00:50 +0000 (10:00 -0700)
committerOri Livneh <ori@wikimedia.org>
Tue, 20 Oct 2015 00:28:09 +0000 (17:28 -0700)
Use BagOStuff::makeKey() and BagOStuff::makeGlobalKey() instead of
wfMemcKey() and wfGlobalCacheKey().

Change-Id: Id4e58c0e616b74de220faf13ba7c9ea606fef8c1

includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderModule.php

index 1221a2d..c9c60bc 100644 (file)
@@ -199,7 +199,7 @@ class ResourceLoader implements LoggerAwareInterface {
                $stats = RequestContext::getMain()->getStats();
                $cache = ObjectCache::newAccelerator( CACHE_ANYTHING );
 
-               $key = wfGlobalCacheKey(
+               $key = $cache->makeGlobalKey(
                        'resourceloader',
                        'filter',
                        $filter,
index bc17821..1b827db 100644 (file)
@@ -970,7 +970,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                $vars = $this->getLessVars( $context );
                ksort( $vars );
                $varsHash = hash( 'md4', serialize( $vars ) );
-               $cacheKey = wfGlobalCacheKey( 'LESS', $fileName, $varsHash );
+               $cacheKey = $cache->makeGlobalKey( 'LESS', $fileName, $varsHash );
                $cachedCompile = $cache->get( $cacheKey );
 
                // If we got a cached value, we have to validate it by getting a
index c50e8b2..714a8ff 100644 (file)
@@ -874,14 +874,13 @@ abstract class ResourceLoaderModule {
        protected function validateScriptFile( $fileName, $contents ) {
                if ( $this->getConfig()->get( 'ResourceLoaderValidateJS' ) ) {
                        // Try for cache hit
-                       // Use CACHE_ANYTHING since parsing JS is much slower than a DB query
-                       $key = wfMemcKey(
+                       $cache = ObjectCache::getLocalClusterInstance();
+                       $key = $cache->makeKey(
                                'resourceloader',
                                'jsparse',
                                self::$parseCacheVersion,
                                md5( $contents )
                        );
-                       $cache = wfGetCache( CACHE_ANYTHING );
                        $cacheEntry = $cache->get( $key );
                        if ( is_string( $cacheEntry ) ) {
                                return $cacheEntry;