public function Store::invalidate in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/HttpCache/Store.php \Symfony\Component\HttpKernel\HttpCache\Store::invalidate()
Invalidates all cache entries that match the request.
Parameters
Request $request A Request instance:
Throws
\RuntimeException
Overrides StoreInterface::invalidate
File
- vendor/
symfony/ http-kernel/ HttpCache/ Store.php, line 228
Class
- Store
- Store implements all the logic for storing cache metadata (Request and Response headers).
Namespace
Symfony\Component\HttpKernel\HttpCacheCode
public function invalidate(Request $request) {
$modified = false;
$key = $this
->getCacheKey($request);
$entries = array();
foreach ($this
->getMetadata($key) as $entry) {
$response = $this
->restoreResponse($entry[1]);
if ($response
->isFresh()) {
$response
->expire();
$modified = true;
$entries[] = array(
$entry[0],
$this
->persistResponse($response),
);
}
else {
$entries[] = $entry;
}
}
if ($modified) {
if (false === $this
->save($key, serialize($entries))) {
throw new \RuntimeException('Unable to store the metadata.');
}
}
}