@@ 328-332 (lines=5) @@ | ||
325 | */ |
|
326 | public function attachItem(CacheItemInterface $item) |
|
327 | { |
|
328 | if(isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
329 | throw new \LogicException('The item already exists and cannot be overwritten because the Spl object hash mismatches ! You probably tried to re-attach a detached item which has been already retrieved from cache.'); |
|
330 | }else{ |
|
331 | $this->itemInstances[$item->getKey()] = $item; |
|
332 | } |
|
333 | } |
|
334 | ||
335 |
@@ 240-244 (lines=5) @@ | ||
237 | /** |
|
238 | * @var ExtendedCacheItemInterface $item |
|
239 | */ |
|
240 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
|
241 | $this->itemInstances[ $item->getKey() ] = $item; |
|
242 | } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
243 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
|
244 | } |
|
245 | ||
246 | /** |
|
247 | * @eventName CacheSaveItem |
|
@@ 271-275 (lines=5) @@ | ||
268 | */ |
|
269 | public function saveDeferred(CacheItemInterface $item) |
|
270 | { |
|
271 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
|
272 | $this->itemInstances[ $item->getKey() ] = $item; |
|
273 | }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
274 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
|
275 | } |
|
276 | ||
277 | /** |
|
278 | * @eventName CacheSaveDeferredItem |