X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2Fwancache%2FWANObjectCache.php;h=dc8f5cd02e7fb5bc19fa320c4a94a1a7561df9bb;hb=7049236d2804c52639abae01d266d3ecaaff480f;hp=a090e16404f28f6cf3ea6e0e2f5a24be3e0f61d7;hpb=b6737798b8bac61f95128557d45f861453bfc406;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/wancache/WANObjectCache.php b/includes/libs/objectcache/wancache/WANObjectCache.php index a090e16404..dc8f5cd02e 100644 --- a/includes/libs/objectcache/wancache/WANObjectCache.php +++ b/includes/libs/objectcache/wancache/WANObjectCache.php @@ -125,7 +125,7 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt /** @var callable|null Function that takes a WAN cache callback and runs it later */ protected $asyncHandler; - /** @bar bool Whether to use mcrouter key prefixing for routing */ + /** @var bool Whether to use mcrouter key prefixing for routing */ protected $mcrouterAware; /** @var string Physical region for mcrouter use */ protected $region; @@ -1269,7 +1269,7 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt // Nested callback process cache use is not lag-safe with regard to HOLDOFF_TTL since // process cached values are more lagged than persistent ones as they are not purged. if ( $pCache && $this->callbackDepth == 0 ) { - $cached = $pCache->get( $this->getProcessCacheKey( $key, $version ), INF, false ); + $cached = $pCache->get( $this->getProcessCacheKey( $key, $version ), $pcTTL, false ); if ( $cached !== false ) { return $cached; } @@ -1311,7 +1311,6 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt * - Cached or regenerated value version number or null if not versioned * - Timestamp of the current cached value at the key or null if there is no value * @note Callable type hints are not used to avoid class-autoloading - * @suppress PhanTypeArraySuspicious */ private function fetchOrRegenerate( $key, $ttl, $callback, array $opts ) { $checkKeys = $opts['checkKeys'] ?? []; @@ -2488,8 +2487,9 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt */ private function determineKeyClassForStats( $key ) { $parts = explode( ':', $key, 3 ); - - return $parts[1] ?? $parts[0]; // sanity + // Sanity fallback in case the key was not made by makeKey. + // Replace dots because they are special in StatsD (T232907) + return strtr( $parts[1] ?? $parts[0], '.', '_' ); } /** @@ -2544,6 +2544,9 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt if ( !isset( $this->processCaches[$group] ) ) { list( , $size ) = explode( ':', $group ); $this->processCaches[$group] = new MapCacheLRU( (int)$size ); + if ( $this->wallClockOverride !== null ) { + $this->processCaches[$group]->setMockTime( $this->wallClockOverride ); + } } return $this->processCaches[$group]; @@ -2640,5 +2643,8 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt public function setMockTime( &$time ) { $this->wallClockOverride =& $time; $this->cache->setMockTime( $time ); + foreach ( $this->processCaches as $pCache ) { + $pCache->setMockTime( $time ); + } } }