Implements \Drupal\Core\CacheDecorator\CacheDecoratorInterface::writeCache().
Cache an array of the system paths available on each page. We assume that aliases will be needed for the majority of these paths during subsequent requests, and load them in a single query during path alias lookup.
Overrides CacheDecoratorInterface::writeCache
public function writeCache() {
$path_lookups = $this
->getPathLookups();
// Check if the system paths for this page were loaded from cache in this
// request to avoid writing to cache on every request.
if ($this->cacheNeedsWriting && !empty($path_lookups) && !empty($this->cacheKeys)) {
// Use the system path of the current request for the cache ID (cid).
$cid = end($this->cacheKeys);
// Set the path cache to expire in 24 hours.
$expire = REQUEST_TIME + 60 * 60 * 24;
$this->cache
->set($cid, $path_lookups, $expire);
}
// We are at the end of the request, so pop off the last request path.
array_pop($this->cacheKeys);
}