Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/206989

Change subject: Converted InfoAction to using the WAN cache
......................................................................

Converted InfoAction to using the WAN cache

Bug: T91815
Change-Id: I8988f77fa5a3504793d9b8e0eea6863888c9e226
---
M includes/actions/InfoAction.php
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/89/206989/1

diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php
index de4f977..203c687 100644
--- a/includes/actions/InfoAction.php
+++ b/includes/actions/InfoAction.php
@@ -64,12 +64,12 @@
         * @param Title $title Title to clear cache for
         */
        public static function invalidateCache( Title $title ) {
-               global $wgMemc;
+               $cache = ObjectCache::getMainWANInstance();
 
                $revision = Revision::newFromTitle( $title, 0, 
Revision::READ_LATEST );
                if ( $revision !== null ) {
                        $key = wfMemcKey( 'infoaction', sha1( 
$title->getPrefixedText() ), $revision->getId() );
-                       $wgMemc->delete( $key );
+                       $cache->delete( $key );
                }
        }
 
@@ -193,7 +193,7 @@
         * @return array
         */
        protected function pageInfo() {
-               global $wgContLang, $wgMemc;
+               global $wgContLang;
 
                $user = $this->getUser();
                $lang = $this->getLanguage();
@@ -201,16 +201,17 @@
                $id = $title->getArticleID();
                $config = $this->context->getConfig();
 
+               $cache = ObjectCache::getMainWANInstance();
                $memcKey = wfMemcKey( 'infoaction',
                        sha1( $title->getPrefixedText() ), 
$this->page->getLatest() );
-               $pageCounts = $wgMemc->get( $memcKey );
+               $pageCounts = $cache->get( $memcKey );
                $version = isset( $pageCounts['cacheversion'] ) ? 
$pageCounts['cacheversion'] : false;
                if ( $pageCounts === false || $version !== self::CACHE_VERSION 
) {
                        // Get page information that would be too "expensive" 
to retrieve by normal means
                        $pageCounts = $this->pageCounts( $title );
                        $pageCounts['cacheversion'] = self::CACHE_VERSION;
 
-                       $wgMemc->set( $memcKey, $pageCounts );
+                       $cache->set( $memcKey, $pageCounts );
                }
 
                // Get page properties

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8988f77fa5a3504793d9b8e0eea6863888c9e226
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to