Update getWithSetCallback() callers to the newer signature
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 8 Oct 2015 02:27:08 +0000 (19:27 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 8 Oct 2015 02:27:08 +0000 (19:27 -0700)
Change-Id: I1cda46178c16b7ffad97d09f8480fd57f766be57

includes/actions/InfoAction.php
includes/changetags/ChangeTags.php
includes/filerepo/LocalRepo.php
includes/interwiki/Interwiki.php

index 78dd5fe..7389ae2 100644 (file)
@@ -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
+                       }
                );
        }
 
index 5531245..55fc104 100644 (file)
@@ -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;
index 02d859f..e93a4a8 100644 (file)
@@ -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
index 7a49f9b..bd8291f 100644 (file)
@@ -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 ) ) {