Merge "Stop overwriting $cache in User::getCacheKey()"

This commit is contained in:
jenkins-bot 2019-02-07 16:57:13 +00:00 committed by Gerrit Code Review
commit 28c6ce84c3

View file

@ -496,7 +496,6 @@ class User implements IDBAccessObject, UserIdentity {
* @return string * @return string
*/ */
protected function getCacheKey( WANObjectCache $cache ) { protected function getCacheKey( WANObjectCache $cache ) {
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
return $cache->makeGlobalKey( 'user', 'id', $lbFactory->getLocalDomainID(), $this->mId ); return $cache->makeGlobalKey( 'user', 'id', $lbFactory->getLocalDomainID(), $this->mId );
@ -520,7 +519,7 @@ class User implements IDBAccessObject, UserIdentity {
* @since 1.25 * @since 1.25
*/ */
protected function loadFromCache() { protected function loadFromCache() {
$cache = ObjectCache::getMainWANInstance(); $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
$data = $cache->getWithSetCallback( $data = $cache->getWithSetCallback(
$this->getCacheKey( $cache ), $this->getCacheKey( $cache ),
$cache::TTL_HOUR, $cache::TTL_HOUR,
@ -2809,7 +2808,7 @@ class User implements IDBAccessObject, UserIdentity {
return; return;
} }
$cache = ObjectCache::getMainWANInstance(); $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
$key = $this->getCacheKey( $cache ); $key = $this->getCacheKey( $cache );
if ( $mode === 'refresh' ) { if ( $mode === 'refresh' ) {
$cache->delete( $key, 1 ); $cache->delete( $key, 1 );