From 4a8da410795d9a355455cf186366642ff5498ddc Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 27 Apr 2015 16:57:08 -0700 Subject: [PATCH] Converted User touched key to using the WAN cache Bug: T93141 Change-Id: Id5478d3007bde3f621b4c3ffe9950a654e0ac30a --- includes/User.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/includes/User.php b/includes/User.php index c3d4a65c6d..69d135bdd6 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2341,15 +2341,14 @@ class User implements IDBAccessObject { * @since 1.25 */ public function touch() { - global $wgMemc; - $this->load(); if ( $this->mId ) { + $this->mQuickTouched = $this->newTouchedTimestamp(); + + $cache = ObjectCache::getMainWANInstance(); $key = wfMemcKey( 'user-quicktouched', 'id', $this->mId ); - $timestamp = $this->newTouchedTimestamp(); - $wgMemc->set( $key, $timestamp ); - $this->mQuickTouched = $timestamp; + $cache->touchCheckKey( $key ); } } @@ -2367,16 +2366,16 @@ class User implements IDBAccessObject { * @return string TS_MW Timestamp */ public function getTouched() { - global $wgMemc; - $this->load(); if ( $this->mId ) { if ( $this->mQuickTouched === null ) { + $cache = ObjectCache::getMainWANInstance(); $key = wfMemcKey( 'user-quicktouched', 'id', $this->mId ); - $timestamp = $wgMemc->get( $key ); + + $timestamp = $cache->getCheckKeyTime( $key ); if ( $timestamp ) { - $this->mQuickTouched = $timestamp; + $this->mQuickTouched = wfTimestamp( TS_MW, $timestamp ); } else { # Set the timestamp to get HTTP 304 cache hits $this->touch(); -- 2.20.1