$checkKeysForAll = [];
$checkKeysByKey = [];
$checkKeysFlat = [];
- foreach ( $checkKeys as $i => $keys ) {
- $prefixed = self::prefixCacheKeys( (array)$keys, self::TIME_KEY_PREFIX );
+ foreach ( $checkKeys as $i => $checkKeyGroup ) {
+ $prefixed = self::prefixCacheKeys( (array)$checkKeyGroup, self::TIME_KEY_PREFIX );
$checkKeysFlat = array_merge( $checkKeysFlat, $prefixed );
// Is this check keys for a specific cache key, or for all keys being fetched?
if ( is_int( $i ) ) {
$wrapExtra[self::FLD_FLAGS] = self::FLG_STALE; // mark as stale
// Case B: any long-running transaction; ignore this set()
} elseif ( $age > self::MAX_READ_LAG ) {
- $this->logger->warning( "Rejected set() for $key due to snapshot lag." );
+ $this->logger->info( "Rejected set() for $key due to snapshot lag." );
return true; // no-op the write for being unsafe
// Case C: high replication lag; lower TTL instead of ignoring all set()s
$this->logger->warning( "Lowered set() TTL for $key due to replication lag." );
// Case D: medium length request with medium replication lag; ignore this set()
} else {
- $this->logger->warning( "Rejected set() for $key due to high read lag." );
+ $this->logger->info( "Rejected set() for $key due to high read lag." );
return true; // no-op the write for being unsafe
}
return false;
}
- // Lifecycle is: new, ramp-up refresh chance, full refresh chance
+ // Lifecycle is: new, ramp-up refresh chance, full refresh chance.
+ // Note that the "expected # of refreshes" for the ramp-up time range is half of what it
+ // would be if P(refresh) was at its full value during that time range.
$refreshWindowSec = max( $timeTillRefresh - $ageNew - self::RAMPUP_TTL / 2, 1 );
// P(refresh) * (# hits in $refreshWindowSec) = (expected # of refreshes)
// P(refresh) * ($refreshWindowSec * $popularHitsPerSec) = 1