Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/206968
Change subject: Converted LocalRepo to using the WAN cache ...................................................................... Converted LocalRepo to using the WAN cache Bug: T91815 Change-Id: Ib806721e27cb00751f2fe579639d27076b7497ed --- M includes/filerepo/LocalRepo.php 1 file changed, 8 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/68/206968/1 diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index e7e4c75..591d684 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -170,7 +170,7 @@ * @return bool|Title */ function checkRedirect( Title $title ) { - global $wgMemc; + $cache = ObjectCache::getMainWANInstance(); $title = File::normalizeTitle( $title, 'exception' ); @@ -181,7 +181,7 @@ } else { $expiry = 86400; // has invalidation, 1 day } - $cachedValue = $wgMemc->get( $memcKey ); + $cachedValue = $cache->get( $memcKey ); if ( $cachedValue === ' ' || $cachedValue === '' ) { // Does not exist return false; @@ -191,7 +191,7 @@ $id = $this->getArticleID( $title ); if ( !$id ) { - $wgMemc->add( $memcKey, " ", $expiry ); + $cache->set( $memcKey, " ", $expiry ); return false; } @@ -205,11 +205,11 @@ if ( $row && $row->rd_namespace == NS_FILE ) { $targetTitle = Title::makeTitle( $row->rd_namespace, $row->rd_title ); - $wgMemc->add( $memcKey, $targetTitle->getDBkey(), $expiry ); + $cache->set( $memcKey, $targetTitle->getDBkey(), $expiry ); return $targetTitle; } else { - $wgMemc->add( $memcKey, '', $expiry ); + $cache->set( $memcKey, '', $expiry ); return false; } @@ -489,14 +489,15 @@ * @return void */ function invalidateImageRedirect( Title $title ) { - global $wgMemc; + $cache = ObjectCache::getMainWANInstance(); + $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) ); if ( $memcKey ) { // Set a temporary value for the cache key, to ensure // that this value stays purged long enough so that // it isn't refreshed with a stale value due to a // lagged slave. - $wgMemc->set( $memcKey, ' PURGED', 12 ); + $cache->delete( $memcKey, 12 ); } } -- To view, visit https://gerrit.wikimedia.org/r/206968 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib806721e27cb00751f2fe579639d27076b7497ed Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core 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