From: Timo Tijhof Date: Wed, 18 Nov 2015 00:21:02 +0000 (+0000) Subject: Use makeGlobalKey() directly instead of wfGlobalCacheKey() X-Git-Tag: 1.31.0-rc.0~8955^2 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=bf331d7c792a3a691d6d3d2371a4e28f2e7755e1;p=lhc%2Fweb%2Fwiklou.git Use makeGlobalKey() directly instead of wfGlobalCacheKey() Saves a small trip through ObjectCache::getLocalClusterInstance(), call_user_func_array, and func_get_args. Change-Id: If5d2170accaecb6cc8c0520ab9de9241b42a4727 --- diff --git a/includes/db/DatabaseMysqlBase.php b/includes/db/DatabaseMysqlBase.php index 4f93419107..38aae58645 100644 --- a/includes/db/DatabaseMysqlBase.php +++ b/includes/db/DatabaseMysqlBase.php @@ -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(); diff --git a/includes/db/loadbalancer/LoadMonitorMySQL.php b/includes/db/loadbalancer/LoadMonitorMySQL.php index 02e75d3893..39077c200e 100644 --- a/includes/db/loadbalancer/LoadMonitorMySQL.php +++ b/includes/db/loadbalancer/LoadMonitorMySQL.php @@ -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 ) ); } } diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index c569b0da58..38d35490e8 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -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 ) ) { diff --git a/includes/utils/FileContentsHasher.php b/includes/utils/FileContentsHasher.php index 12f6285325..c74b04de2d 100644 --- a/includes/utils/FileContentsHasher.php +++ b/includes/utils/FileContentsHasher.php @@ -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 ) {