From 91c7084b63255146faf790d0f7e7ac7574336ee9 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 7 Oct 2015 19:27:08 -0700 Subject: [PATCH] Update getWithSetCallback() callers to the newer signature Change-Id: I1cda46178c16b7ffad97d09f8480fd57f766be57 --- includes/actions/InfoAction.php | 4 ++-- includes/changetags/ChangeTags.php | 32 +++++++++++++++++++----------- includes/filerepo/LocalRepo.php | 4 ++-- includes/interwiki/Interwiki.php | 4 ++-- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 78dd5fe926..7389ae2c02 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -675,6 +675,7 @@ class InfoAction extends FormlessAction { return ObjectCache::getMainWANInstance()->getWithSetCallback( self::getCacheKey( $page->getTitle(), $page->getLatest() ), + 86400 * 7, function ( $oldValue, &$ttl, &$setOpts ) use ( $page, $config, $fname ) { $title = $page->getTitle(); $id = $title->getArticleID(); @@ -818,8 +819,7 @@ class InfoAction extends FormlessAction { ); return $result; - }, - 86400 * 7 + } ); } diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index 5531245679..55fc104083 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -1090,6 +1090,7 @@ class ChangeTags { public static function listExtensionActivatedTags() { return ObjectCache::getMainWANInstance()->getWithSetCallback( wfMemcKey( 'active-tags' ), + 300, function ( $oldValue, &$ttl, array &$setOpts ) { $setOpts += Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) ); @@ -1098,9 +1099,10 @@ class ChangeTags { Hooks::run( 'ChangeTagsListActive', array( &$extensionActive ) ); return $extensionActive; }, - 300, - array( wfMemcKey( 'active-tags' ) ), - array( 'lockTSE' => INF ) + array( + 'checkKeys' => array( wfMemcKey( 'active-tags' ) ), + 'lockTSE' => INF + ) ); } @@ -1132,6 +1134,7 @@ class ChangeTags { return ObjectCache::getMainWANInstance()->getWithSetCallback( wfMemcKey( 'valid-tags-db' ), + 300, function ( $oldValue, &$ttl, array &$setOpts ) use ( $fname ) { $dbr = wfGetDB( DB_SLAVE ); @@ -1141,9 +1144,10 @@ class ChangeTags { return array_filter( array_unique( $tags ) ); }, - 300, - array( wfMemcKey( 'valid-tags-db' ) ), - array( 'lockTSE' => INF ) + array( + 'checkKeys' => array( wfMemcKey( 'valid-tags-db' ) ), + 'lockTSE' => INF + ) ); } @@ -1159,6 +1163,7 @@ class ChangeTags { public static function listExtensionDefinedTags() { return ObjectCache::getMainWANInstance()->getWithSetCallback( wfMemcKey( 'valid-tags-hook' ), + 300, function ( $oldValue, &$ttl, array &$setOpts ) { $setOpts += Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) ); @@ -1166,9 +1171,10 @@ class ChangeTags { Hooks::run( 'ListDefinedTags', array( &$tags ) ); return array_filter( array_unique( $tags ) ); }, - 300, - array( wfMemcKey( 'valid-tags-hook' ) ), - array( 'lockTSE' => INF ) + array( + 'checkKeys' => array( wfMemcKey( 'valid-tags-hook' ) ), + 'lockTSE' => INF + ) ); } @@ -1218,6 +1224,7 @@ class ChangeTags { $fname = __METHOD__; $cachedStats = ObjectCache::getMainWANInstance()->getWithSetCallback( wfMemcKey( 'change-tag-statistics' ), + 300, function ( $oldValue, &$ttl, array &$setOpts ) use ( $fname ) { $dbr = wfGetDB( DB_SLAVE, 'vslow' ); @@ -1238,9 +1245,10 @@ class ChangeTags { return $out; }, - 300, - array( wfMemcKey( 'change-tag-statistics' ) ), - array( 'lockTSE' => INF ) + array( + 'checkKeys' => array( wfMemcKey( 'change-tag-statistics' ) ), + 'lockTSE' => INF + ) ); return $cachedStats; diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index 02d859f28c..e93a4a857a 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -202,6 +202,7 @@ class LocalRepo extends FileRepo { $that = $this; $redirDbKey = ObjectCache::getMainWANInstance()->getWithSetCallback( $memcKey, + $expiry, function ( $oldValue, &$ttl, array &$setOpts ) use ( $that, $title ) { $dbr = $that->getSlaveDB(); // possibly remote DB @@ -225,8 +226,7 @@ class LocalRepo extends FileRepo { return ( $row && $row->rd_namespace == NS_FILE ) ? Title::makeTitle( $row->rd_namespace, $row->rd_title )->getDBkey() : ''; // negative cache - }, - $expiry + } ); // @note: also checks " " for b/c diff --git a/includes/interwiki/Interwiki.php b/includes/interwiki/Interwiki.php index 7a49f9be89..bd8291ff4b 100644 --- a/includes/interwiki/Interwiki.php +++ b/includes/interwiki/Interwiki.php @@ -218,6 +218,7 @@ class Interwiki { $iwData = ObjectCache::getMainWANInstance()->getWithSetCallback( wfMemcKey( 'interwiki', $prefix ), + $wgInterwikiExpiry, function ( $oldValue, &$ttl, array &$setOpts ) use ( $prefix ) { $dbr = wfGetDB( DB_SLAVE ); @@ -231,8 +232,7 @@ class Interwiki { ); return $row ? (array)$row : '!NONEXISTENT'; - }, - $wgInterwikiExpiry + } ); if ( is_array( $iwData ) ) { -- 2.20.1