TtlJitter
in package
FinalYes
Applies a ±10 % jitter to cache TTLs.
Keys created at the same moment (warm-up after a deploy, a tag bump of a hot list) then do not expire together and cold builds spread over time. Shared by the query cache (QueryCache), the route table and the router slug maps.
Table of Contents
Constants
- FALLBACK_TTL : mixed = 300
- Fallback TTL in seconds when the configuration yields a non-positive value.
- RATIO : mixed = 0.1
- Spread of ±10 % around the base TTL.
Methods
- apply() : int
- Returns the TTL ± `RATIO`; a non-positive base uses `FALLBACK_TTL`, the minimum is 1 second.
Constants
FALLBACK_TTL
Fallback TTL in seconds when the configuration yields a non-positive value.
public
mixed
FALLBACK_TTL
= 300
RATIO
Spread of ±10 % around the base TTL.
public
mixed
RATIO
= 0.1
Methods
apply()
Returns the TTL ± `RATIO`; a non-positive base uses `FALLBACK_TTL`, the minimum is 1 second.
public
static apply(int $baseTtl) : int
Parameters
- $baseTtl : int