public function getItem($key)
{
$this->validateKey($key);
if (isset($this->deferred[$key])) {
$item = $this->deferred[$key];
return is_object($item) ? clone $item : $item;
}
$func = function () use($key) {
try {
return $this->fetchObjectFromCache($key);
} catch (\Exception $e) {
$this->handleException($e, __FUNCTION__);
}
};
return new CacheItem($key, $func);
}