jenkins-bot has submitted this change and it was merged.

Change subject: Conversion to WANObjectCache
......................................................................


Conversion to WANObjectCache

Bug: T93141
Change-Id: Icf2981d7f690330788d22deb83856e1793ff3c33
---
M includes/CentralAuthUser.php
1 file changed, 8 insertions(+), 9 deletions(-)

Approvals:
  Chad: Looks good to me, but someone else must approve
  Gergő Tisza: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/CentralAuthUser.php b/includes/CentralAuthUser.php
old mode 100644
new mode 100755
index 5dd3c64..4987439
--- a/includes/CentralAuthUser.php
+++ b/includes/CentralAuthUser.php
@@ -323,8 +323,7 @@
         */
        protected function loadFromCache( $cache = null, $fromMaster = false ) {
                if ( $cache == null ) {
-                       global $wgMemc;
-                       $cache = $wgMemc->get( $this->getCacheKey() );
+                       $cache = ObjectCache::getMainWANInstance()->get( 
$this->getCacheKey() );
                        $fromMaster = true;
                }
 
@@ -383,8 +382,6 @@
         * Save cachable data to memcached.
         */
        protected function saveToCache() {
-               global $wgMemc;
-
                // Make sure the data is fresh
                if ( isset( $this->mGlobalId ) && !$this->mFromMaster ) {
                        $this->resetState();
@@ -392,8 +389,8 @@
 
                $obj = $this->getCacheObject();
                wfDebugLog( 'CentralAuthVerbose', "Saving user {$this->mName} 
to cache." );
-               $wgMemc->set( $this->getCacheKey(), $obj, 86400 );
-        }
+               ObjectCache::getMainWANInstance()->set( $this->getCacheKey(), 
$obj, 86400 );
+       }
 
        /**
         * Return the global account ID number for this account, if it exists.
@@ -2653,8 +2650,9 @@
        public function invalidateCache() {
                if ( !$this->mDelayInvalidation ) {
                        wfDebugLog( 'CentralAuthVerbose', "Updating cache for 
global user {$this->mName}" );
-
-                       // Reload the state and overwrite the cache.
+                       // Purge the cache
+                       $this->quickInvalidateCache();
+                       // Reload the state
                        $this->loadStateNoCache();
                } else {
                        wfDebugLog( 'CentralAuthVerbose', "Deferring cache 
invalidation because we're in a transaction" );
@@ -2669,7 +2667,8 @@
 
                wfDebugLog( 'CentralAuthVerbose', "Quick cache invalidation for 
global user {$this->mName}" );
 
-               $wgMemc->delete( $this->getCacheKey() );
+               ObjectCache::getMainWANInstance()->delete( $this->getCacheKey() 
);
+               $wgMemc->delete( $this->getCacheKey() ); // transition b/c
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/225013
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icf2981d7f690330788d22deb83856e1793ff3c33
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: CSteipp <cste...@wikimedia.org>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to