Use makeGlobalKey() directly instead of wfGlobalCacheKey()
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 18 Nov 2015 00:21:02 +0000 (00:21 +0000)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 18 Nov 2015 00:21:02 +0000 (00:21 +0000)
Saves a small trip through ObjectCache::getLocalClusterInstance(),
call_user_func_array, and func_get_args.

Change-Id: If5d2170accaecb6cc8c0520ab9de9241b42a4727

includes/db/DatabaseMysqlBase.php
includes/db/loadbalancer/LoadMonitorMySQL.php
includes/specials/SpecialUserlogin.php
includes/utils/FileContentsHasher.php

index 4f93419..38aae58 100644 (file)
@@ -687,7 +687,7 @@ abstract class DatabaseMysqlBase extends Database {
                        return parent::getApproximateLagStatus();
                }
 
-               $key = wfGlobalCacheKey( 'mysql-lag', $this->getServer() );
+               $key = $this->srvCache->makeGlobalKey( 'mysql-lag', $this->getServer() );
                $approxLag = $this->srvCache->get( $key );
                if ( !$approxLag ) {
                        $approxLag = parent::getApproximateLagStatus();
index 02e75d3..39077c2 100644 (file)
@@ -118,7 +118,7 @@ class LoadMonitorMySQL implements LoadMonitor {
        }
 
        private function getLagTimeCacheKey() {
-               # Lag is per-server, not per-DB, so key on the master DB name
-               return wfGlobalCacheKey( 'lag-times', $this->parent->getServerName( 0 ) );
+               // Lag is per-server, not per-DB, so key on the master DB name
+               return $this->srvCache->makeGlobalKey( 'lag-times', $this->parent->getServerName( 0 ) );
        }
 }
index c569b0d..38d3549 100644 (file)
@@ -567,7 +567,7 @@ class LoginForm extends SpecialPage {
 
                $cache = ObjectCache::getLocalClusterInstance();
                # Make sure the user does not exist already
-               $lock = $cache->getScopedLock( wfGlobalCacheKey( 'account', md5( $this->mUsername ) ) );
+               $lock = $cache->getScopedLock( $cache->makeGlobalKey( 'account', md5( $this->mUsername ) ) );
                if ( !$lock ) {
                        return Status::newFatal( 'usernameinprogress' );
                } elseif ( $u->idForName( User::READ_LOCKING ) ) {
index 12f6285..c74b04d 100644 (file)
@@ -62,7 +62,7 @@ class FileContentsHasher {
                        return false;
                }
 
-               $cacheKey = wfGlobalCacheKey( __CLASS__, $filePath, $mtime, $algo );
+               $cacheKey = $this->cache->makeGlobalKey( __CLASS__, $filePath, $mtime, $algo );
                $hash = $this->cache->get( $cacheKey );
 
                if ( $hash ) {