objectcache: Deprecate WANObjectCache::reap() and ::reapCheckKey()
Follows-up Ia550ef7fe3 (4d3549ad71) which added reap to NameTableStore in 2018, which was then (mostly) removed again with I63e61e1ab (2c7e4adcea) for T198561, except one call was left behind in reloadMap(). I've changed this to match the existing delete call in acquireId(). To be removed in I0654c29a671467dd6. Change-Id: I7541c9c6d1ef70d552944aca94cbc4d0f7ec0d5b
This commit is contained in:
parent
b245a6a284
commit
7a6301e03d
4 changed files with 14 additions and 7 deletions
|
|
@ -497,6 +497,8 @@ because of Phabricator reports.
|
|||
ResourceLoaderStartUpModule, ResourceLoaderUserModule,
|
||||
ResourceLoaderUserOptionsModule, ResourceLoaderUserStylesModule,
|
||||
ResourceLoaderWikiModule.
|
||||
* WANObjectCache::reap() and WANObjectCache::reapCheckKey() have been
|
||||
deprecated without replacement.
|
||||
* The following methods in WikiRevision and their interfaces
|
||||
ImportableUploadRevision and ImportableOldRevision are deprecated:
|
||||
- ::getUserObj() → ::getUser()
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ class NameTableStore {
|
|||
// As store returned an ID we know we inserted so delete from WAN cache
|
||||
$dbw = $this->getDBConnection( DB_PRIMARY );
|
||||
$dbw->onTransactionPreCommitOrIdle( function () {
|
||||
$this->cache->delete( $this->getCacheKey() );
|
||||
$this->cache->delete( $this->getCacheKey(), WANObjectCache::HOLDOFF_TTL_NONE );
|
||||
}, __METHOD__ );
|
||||
}
|
||||
$this->tableCache = $table;
|
||||
|
|
@ -232,7 +232,7 @@ class NameTableStore {
|
|||
$dbw = $this->getDBConnection( DB_PRIMARY, $connFlags );
|
||||
$this->tableCache = $this->loadTable( $dbw );
|
||||
$dbw->onTransactionPreCommitOrIdle( function () {
|
||||
$this->cache->reap( $this->getCacheKey(), INF );
|
||||
$this->cache->delete( $this->getCacheKey() );
|
||||
}, __METHOD__ );
|
||||
|
||||
return $this->tableCache;
|
||||
|
|
|
|||
|
|
@ -2251,6 +2251,7 @@ class WANObjectCache implements
|
|||
* This sets stale keys' time-to-live at HOLDOFF_TTL seconds, which both avoids
|
||||
* broadcasting in mcrouter setups and also avoids races with new tombstones.
|
||||
*
|
||||
* @deprecated since 1.39 No longer supported.
|
||||
* @param string $key Cache key made with makeKey()/makeGlobalKey()
|
||||
* @param int|float $purgeTimestamp UNIX timestamp of purge
|
||||
* @param bool &$isStale Whether the key is stale
|
||||
|
|
@ -2258,6 +2259,7 @@ class WANObjectCache implements
|
|||
* @since 1.28
|
||||
*/
|
||||
final public function reap( $key, $purgeTimestamp, &$isStale = false ) {
|
||||
wfDeprecated( __METHOD__, '1.39' );
|
||||
$valueSisterKey = $this->makeSisterKey( $key, self::TYPE_VALUE );
|
||||
|
||||
$minAsOf = $purgeTimestamp + self::HOLDOFF_TTL;
|
||||
|
|
@ -2283,6 +2285,7 @@ class WANObjectCache implements
|
|||
/**
|
||||
* Set a "check" key to soon expire in the local cluster if it pre-dates $purgeTimestamp
|
||||
*
|
||||
* @deprecated since 1.39 No longer supported.
|
||||
* @param string $key Cache key made with makeKey()/makeGlobalKey()
|
||||
* @param int $purgeTimestamp UNIX timestamp of purge
|
||||
* @param bool &$isStale Whether the key is stale
|
||||
|
|
@ -2290,6 +2293,7 @@ class WANObjectCache implements
|
|||
* @since 1.28
|
||||
*/
|
||||
final public function reapCheckKey( $key, $purgeTimestamp, &$isStale = false ) {
|
||||
wfDeprecated( __METHOD__, '1.39' );
|
||||
$checkSisterKey = $this->makeSisterKey( $key, self::TYPE_TIMESTAMP );
|
||||
|
||||
$wrapped = $this->cache->get( $checkSisterKey );
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@ use Wikimedia\TestingAccessWrapper;
|
|||
* @covers WANObjectCache::getInterimValue
|
||||
* @covers WANObjectCache::setInterimValue
|
||||
*/
|
||||
class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
use MediaWikiCoversValidator;
|
||||
class WANObjectCacheTest extends MediaWikiUnitTestCase {
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
|
|
@ -1978,6 +1976,9 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
|
|||
* @covers WANObjectCache::reapCheckKey()
|
||||
*/
|
||||
public function testReap() {
|
||||
$this->hideDeprecated( 'WANObjectCache::reap' );
|
||||
$this->hideDeprecated( 'WANObjectCache::reapCheckKey' );
|
||||
|
||||
list( $cache, $bag ) = $this->newWanCache();
|
||||
$vKey1 = wfRandomString();
|
||||
$vKey2 = wfRandomString();
|
||||
|
|
@ -2036,6 +2037,8 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
|
|||
* @covers WANObjectCache::reap()
|
||||
*/
|
||||
public function testReap_fail() {
|
||||
$this->hideDeprecated( 'WANObjectCache::reap' );
|
||||
|
||||
$backend = $this->getMockBuilder( EmptyBagOStuff::class )
|
||||
->onlyMethods( [ 'get', 'changeTTL' ] )->getMock();
|
||||
$backend->expects( $this->once() )->method( 'get' )
|
||||
|
|
@ -2147,8 +2150,6 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
|
|||
$wanCache->getMulti( [ 'x', 'y' ], $ctls, [ 'check2' ] );
|
||||
$wanCache->getWithSetCallback( 'p', 30, $valFunc );
|
||||
$wanCache->getCheckKeyTime( 'zzz' );
|
||||
$wanCache->reap( 'x', time() - 300 );
|
||||
$wanCache->reap( 'zzz', time() - 300 );
|
||||
}
|
||||
|
||||
public function testMcRouterSupportBroadcastDelete() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue