Converted sidebar cache to the WAN cache
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 27 Apr 2015 21:56:52 +0000 (14:56 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 7 May 2015 23:30:48 +0000 (23:30 +0000)
Bug: T93141
Change-Id: Id99f886c48501bbfef85cb0e7c5d2e2810a68581

includes/cache/MessageCache.php
includes/skins/Skin.php

index a55e25a..31ee487 100644 (file)
@@ -554,10 +554,10 @@ class MessageCache {
                        $codes = array_keys( Language::fetchLanguageNames() );
                }
 
-               global $wgMemc;
+               $cache = ObjectCache::getMainWANInstance();
                foreach ( $codes as $code ) {
                        $sidebarKey = wfMemcKey( 'sidebar', $code );
-                       $wgMemc->delete( $sidebarKey );
+                       $cache->delete( $sidebarKey, 5 );
                }
 
                // Update the message in the message blob store
index 07a2e87..6c5fbcd 100644 (file)
@@ -1234,12 +1234,13 @@ abstract class Skin extends ContextSource {
         * @return array
         */
        function buildSidebar() {
-               global $wgMemc, $wgEnableSidebarCache, $wgSidebarCacheExpiry;
+               global $wgEnableSidebarCache, $wgSidebarCacheExpiry;
 
+               $cache = ObjectCache::getMainWANInstance();
                $key = wfMemcKey( 'sidebar', $this->getLanguage()->getCode() );
 
                if ( $wgEnableSidebarCache ) {
-                       $cachedsidebar = $wgMemc->get( $key );
+                       $cachedsidebar = $cache->get( $key );
                        if ( $cachedsidebar ) {
                                Hooks::run( 'SidebarBeforeOutput', array( $this, &$cachedsidebar ) );
 
@@ -1252,7 +1253,7 @@ abstract class Skin extends ContextSource {
 
                Hooks::run( 'SkinBuildSidebar', array( $this, &$bar ) );
                if ( $wgEnableSidebarCache ) {
-                       $wgMemc->set( $key, $bar, $wgSidebarCacheExpiry );
+                       $cache->set( $key, $bar, $wgSidebarCacheExpiry );
                }
 
                Hooks::run( 'SidebarBeforeOutput', array( $this, &$bar ) );