From 2df6d541826d1a7454b3fb22a25462cd44ce15b5 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 16 Sep 2015 10:05:54 -0700 Subject: [PATCH] Moved some WANObjectCache number literals to constants Change-Id: I848440408b54c1dfd4961c15cc83aad9a1a19425 --- includes/libs/objectcache/WANObjectCache.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; -- 2.20.1