public function getRouteName(string $resourceClass, bool $collection) : string
{
$cacheKey = self::CACHE_KEY_PREFIX . md5(serialize([$resourceClass, $collection]));
try {
$cacheItem = $this->cacheItemPool->getItem($cacheKey);
if ($cacheItem->isHit()) {
return $cacheItem->get();
}
} catch (CacheException $e) {
// do nothing
}
$routeName = $this->decorated->getRouteName($resourceClass, $collection);
if (!isset($cacheItem)) {
return $routeName;
}
try {
$cacheItem->set($routeName);
$this->cacheItemPool->save($cacheItem);
} catch (CacheException $e) {
// do nothing
}
return $routeName;
}