Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/284931
Change subject: Switch $wgMemc usage to proper cache/stash usage ...................................................................... Switch $wgMemc usage to proper cache/stash usage Change-Id: I688e21ff4ff999f11c0373ad611075c14fa5db2a --- M includes/ContainmentSet.php M includes/EmailBundler.php M includes/controller/NotificationController.php 3 files changed, 8 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo refs/changes/31/284931/1 diff --git a/includes/ContainmentSet.php b/includes/ContainmentSet.php index 17e4437..fd3eeda 100644 --- a/includes/ContainmentSet.php +++ b/includes/ContainmentSet.php @@ -22,9 +22,10 @@ * from multiple sources like global variables, wiki pages, etc. * * Initialize: + * $cache = ObjectCache::getLocalClusterIntance(); * $set = new EchoContainmentSet; * $set->addArray( $wgSomeGlobalParameter ); - * $set->addOnWiki( NS_USER, 'Foo/bar-baz', $wgMemc, 'some_user_specific_cache_key' ); + * $set->addOnWiki( NS_USER, 'Foo/bar-baz', $cache, 'some_user_specific_cache_key' ); * * Usage: * if ( $set->contains( 'SomeUser' ) ) { diff --git a/includes/EmailBundler.php b/includes/EmailBundler.php index 438580a..0e114c7 100644 --- a/includes/EmailBundler.php +++ b/includes/EmailBundler.php @@ -154,9 +154,7 @@ * Get the timestamp of last email */ protected function retrieveLastEmailTimestamp() { - global $wgMemc; - - $data = $wgMemc->get( $this->getMemcacheKey() ); + $data = ObjectCache::getMainStashInstance()->get( $this->getMemcacheKey() ); if ( $data !== false ) { $this->timestamp = $data['timestamp']; } @@ -279,12 +277,10 @@ * Update bundle email metadata for user/hash pair */ protected function updateEmailMetadata() { - global $wgMemc; - $key = $this->getMemcacheKey(); // Store new data and make it expire in 7 days - $wgMemc->set( + ObjectCache::getMainStashInstance()->set( $key, array( 'timestamp' => $this->timestamp diff --git a/includes/controller/NotificationController.php b/includes/controller/NotificationController.php index 5c07338..cba9d23 100644 --- a/includes/controller/NotificationController.php +++ b/includes/controller/NotificationController.php @@ -190,8 +190,7 @@ } if ( self::$blacklist === null ) { - global $wgEchoAgentBlacklist, $wgEchoOnWikiBlacklist, - $wgMemc; + global $wgEchoAgentBlacklist, $wgEchoOnWikiBlacklist; self::$blacklist = new EchoContainmentSet; self::$blacklist->addArray( $wgEchoAgentBlacklist ); @@ -199,7 +198,7 @@ self::$blacklist->addOnWiki( NS_MEDIAWIKI, $wgEchoOnWikiBlacklist, - $wgMemc, + ObjectCache::getLocalClusterInstance(), wfMemcKey( "echo_on_wiki_blacklist" ) ); } @@ -216,7 +215,7 @@ * @return boolean True when the event agent is in the user whitelist */ public static function isWhitelistedByUser( EchoEvent $event, User $user ) { - global $wgEchoPerUserWhitelistFormat, $wgMemc; + global $wgEchoPerUserWhitelistFormat; if ( $wgEchoPerUserWhitelistFormat === null || !$event->getAgent() ) { return false; @@ -232,7 +231,7 @@ self::$userWhitelist[$userId]->addOnWiki( NS_USER, sprintf( $wgEchoPerUserWhitelistFormat, $user->getName() ), - $wgMemc, + ObjectCache::getLocalClusterInstance(), wfMemcKey( "echo_on_wiki_whitelist_" . $userId ) ); } -- To view, visit https://gerrit.wikimedia.org/r/284931 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I688e21ff4ff999f11c0373ad611075c14fa5db2a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Echo Gerrit-Branch: master Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits