- /** Cache format version number */
- const VERSION = 1;
-
- const FLD_FORMAT_VERSION = 0; // key to WAN cache version number
- const FLD_VALUE = 1; // key to the cached value
- const FLD_TTL = 2; // key to the original TTL
- const FLD_TIME = 3; // key to the cache timestamp
- const FLD_FLAGS = 4; // key to the flags bitfield (reserved number)
- const FLD_VALUE_VERSION = 5; // key to collection cache version number
- const FLD_GENERATION_TIME = 6; // key to how long it took to generate the value
-
- const PURGE_TIME = 0; // key to the tombstone entry timestamp
- const PURGE_HOLDOFF = 1; // key to the tombstone entry hold-off TTL
-
- const VALUE_KEY_PREFIX = 'WANCache:v:';
- const INTERIM_KEY_PREFIX = 'WANCache:i:';
- const TIME_KEY_PREFIX = 'WANCache:t:';
- const MUTEX_KEY_PREFIX = 'WANCache:m:';
- const COOLOFF_KEY_PREFIX = 'WANCache:c:';
-
- const PURGE_VAL_PREFIX = 'PURGED:';
-
- const PC_PRIMARY = 'primary:1000'; // process cache name and max key count
+ /** @var int Seconds to keep dependency purge keys around */
+ private static $CHECK_KEY_TTL = self::TTL_YEAR;
+ /** @var int Seconds to keep interim value keys for tombstoned keys around */
+ private static $INTERIM_KEY_TTL = 1;
+
+ /** @var int Seconds to keep lock keys around */
+ private static $LOCK_TTL = 10;
+ /** @var int Seconds to no-op key set() calls to avoid large blob I/O stampedes */
+ private static $COOLOFF_TTL = 1;
+ /** @var int Seconds to ramp up the chance of regeneration due to expected time-till-refresh */
+ private static $RAMPUP_TTL = 30;
+
+ /** @var float Tiny negative float to use when CTL comes up >= 0 due to clock skew */
+ private static $TINY_NEGATIVE = -0.000001;
+ /** @var float Tiny positive float to use when using "minTime" to assert an inequality */
+ private static $TINY_POSTIVE = 0.000001;
+
+ /** @var int Milliseconds of key fetch/validate/regenerate delay prone to set() stampedes */
+ private static $SET_DELAY_HIGH_MS = 50;
+ /** @var int Min millisecond set() backoff during hold-off (far less than INTERIM_KEY_TTL) */
+ private static $RECENT_SET_LOW_MS = 50;
+ /** @var int Max millisecond set() backoff during hold-off (far less than INTERIM_KEY_TTL) */
+ private static $RECENT_SET_HIGH_MS = 100;
+
+ /** @var int Consider value generation slow if it takes more than this many seconds */
+ private static $GENERATION_SLOW_SEC = 3;
+
+ /** @var int Key to the tombstone entry timestamp */
+ private static $PURGE_TIME = 0;
+ /** @var int Key to the tombstone entry hold-off TTL */
+ private static $PURGE_HOLDOFF = 1;
+
+ /** @var int Cache format version number */
+ private static $VERSION = 1;
+
+ /** @var int Key to WAN cache version number */
+ private static $FLD_FORMAT_VERSION = 0;
+ /** @var int Key to the cached value */
+ private static $FLD_VALUE = 1;
+ /** @var int Key to the original TTL */
+ private static $FLD_TTL = 2;
+ /** @var int Key to the cache timestamp */
+ private static $FLD_TIME = 3;
+ /** @var int Key to the flags bit field (reserved number) */
+ private static /** @noinspection PhpUnusedPrivateFieldInspection */ $FLD_FLAGS = 4;
+ /** @var int Key to collection cache version number */
+ private static $FLD_VALUE_VERSION = 5;
+ /** @var int Key to how long it took to generate the value */
+ private static $FLD_GENERATION_TIME = 6;
+
+ private static $VALUE_KEY_PREFIX = 'WANCache:v:';
+ private static $INTERIM_KEY_PREFIX = 'WANCache:i:';
+ private static $TIME_KEY_PREFIX = 'WANCache:t:';
+ private static $MUTEX_KEY_PREFIX = 'WANCache:m:';
+ private static $COOLOFF_KEY_PREFIX = 'WANCache:c:';
+
+ private static $PURGE_VAL_PREFIX = 'PURGED:';