Invalidates all cache entries that match the request.
Request $request A Request instance:
\RuntimeException
Overrides StoreInterface::invalidate
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.');
}
}
}