From: Aaron Schulz Date: Fri, 16 Feb 2018 22:23:49 +0000 (-0800) Subject: objectcache: add IExpiringStore::TTL_SECOND constant X-Git-Tag: 1.31.0-rc.0~580^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=8e89785e250e085022dcb5a09b605d388d7b07fa objectcache: add IExpiringStore::TTL_SECOND constant Change-Id: Iec59ce72f3dbb0de68c8f6704d86f1522f86827e --- diff --git a/includes/libs/objectcache/IExpiringStore.php b/includes/libs/objectcache/IExpiringStore.php index 0e09f16f04..7bab20a3b9 100644 --- a/includes/libs/objectcache/IExpiringStore.php +++ b/includes/libs/objectcache/IExpiringStore.php @@ -30,6 +30,7 @@ */ interface IExpiringStore { // Constants for TTL values, in seconds + const TTL_SECOND = 1; const TTL_MINUTE = 60; const TTL_HOUR = 3600; const TTL_DAY = 86400; // 24 * 3600 diff --git a/includes/libs/objectcache/WANObjectCache.php b/includes/libs/objectcache/WANObjectCache.php index 58d359cbf3..bcd95c1c20 100644 --- a/includes/libs/objectcache/WANObjectCache.php +++ b/includes/libs/objectcache/WANObjectCache.php @@ -1581,7 +1581,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { if ( $purge && $purge[self::FLD_TIME] < $purgeTimestamp ) { $isStale = true; $this->logger->warning( "Reaping stale check key '$key'." ); - $ok = $this->cache->changeTTL( self::TIME_KEY_PREFIX . $key, 1 ); + $ok = $this->cache->changeTTL( self::TIME_KEY_PREFIX . $key, self::TTL_SECOND ); if ( !$ok ) { $this->logger->error( "Could not complete reap of check key '$key'." ); } @@ -1824,7 +1824,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { 'cmd' => 'set', 'key' => $key, 'val' => 'PURGED:$UNIXTIME$:' . (int)$holdoff, - 'ttl' => max( $ttl, 1 ), + 'ttl' => max( $ttl, self::TTL_SECOND ), 'sbt' => true, // substitute $UNIXTIME$ with actual microtime ] );