From: Aaron Schulz Date: Wed, 16 Sep 2015 17:05:54 +0000 (-0700) Subject: Moved some WANObjectCache number literals to constants X-Git-Tag: 1.31.0-rc.0~10000^2 X-Git-Url: http://git.cyclocoop.org///%22%40url%40//%22?a=commitdiff_plain;h=2df6d541826d1a7454b3fb22a25462cd44ce15b5;p=lhc%2Fweb%2Fwiklou.git Moved some WANObjectCache number literals to constants Change-Id: I848440408b54c1dfd4961c15cc83aad9a1a19425 --- diff --git a/includes/libs/objectcache/WANObjectCache.php b/includes/libs/objectcache/WANObjectCache.php index dcd413d248..56c544fd79 100644 --- a/includes/libs/objectcache/WANObjectCache.php +++ b/includes/libs/objectcache/WANObjectCache.php @@ -73,6 +73,10 @@ class WANObjectCache { const CHECK_KEY_TTL = 31536000; // 1 year /** Seconds to keep lock keys around */ const LOCK_TTL = 5; + /** Default remaining TTL at which to consider pre-emptive regeneration */ + const LOW_TTL = 10; + /** Default TTL for temporarily caching tombstoned keys */ + const TEMP_TTL = 5; /** Idiom for set()/getWithSetCallback() TTL */ const TTL_NONE = 0; @@ -473,9 +477,9 @@ class WANObjectCache { final public function getWithSetCallback( $key, $callback, $ttl, array $checkKeys = array(), array $opts = array() ) { - $lowTTL = isset( $opts['lowTTL'] ) ? $opts['lowTTL'] : min( 10, $ttl ); + $lowTTL = isset( $opts['lowTTL'] ) ? $opts['lowTTL'] : min( self::LOW_TTL, $ttl ); $lockTSE = isset( $opts['lockTSE'] ) ? $opts['lockTSE'] : -1; - $tempTTL = isset( $opts['tempTTL'] ) ? $opts['tempTTL'] : 5; + $tempTTL = isset( $opts['tempTTL'] ) ? $opts['tempTTL'] : self::TEMP_TTL; // Get the current key value $curTTL = null;