/** @var bool|array{maxAge?: int, states?: list<string>}|null $cache */
$cache =
$request->attributes->
get(PlatformRequest::ATTRIBUTE_HTTP_CACHE
);
if (!
$cache) { return;
} if ($cache === true
) { $cache =
[];
} if ($this->
hasInvalidationState($cache['states'
] ??
[],
$states)) { return;
} $maxAge =
$cache['maxAge'
] ??
$this->defaultTtl;
$response->
setSharedMaxAge($maxAge);
$response->headers->
addCacheControlDirective('must-revalidate'
);
$response->headers->
set( self::INVALIDATION_STATES_HEADER,
implode(',',
$cache['states'
] ??
[]) );