| @@ 410-414 (lines=5) @@ | ||
| 407 | */ |
|
| 408 | public function attachItem(CacheItemInterface $item) |
|
| 409 | { |
|
| 410 | if (isset($this->itemInstances[ $item->getKey() ]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])) { |
|
| 411 | 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.'); |
|
| 412 | } else { |
|
| 413 | $this->itemInstances[ $item->getKey() ] = $item; |
|
| 414 | } |
|
| 415 | } |
|
| 416 | ||
| 417 | ||
| @@ 249-253 (lines=5) @@ | ||
| 246 | /** |
|
| 247 | * @var ExtendedCacheItemInterface $item |
|
| 248 | */ |
|
| 249 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
|
| 250 | $this->itemInstances[ $item->getKey() ] = $item; |
|
| 251 | } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
| 252 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
|
| 253 | } |
|
| 254 | ||
| 255 | /** |
|
| 256 | * @eventName CacheSaveItem |
|
| @@ 280-284 (lines=5) @@ | ||
| 277 | */ |
|
| 278 | public function saveDeferred(CacheItemInterface $item) |
|
| 279 | { |
|
| 280 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
|
| 281 | $this->itemInstances[ $item->getKey() ] = $item; |
|
| 282 | }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
| 283 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
|
| 284 | } |
|
| 285 | ||
| 286 | /** |
|
| 287 | * @eventName CacheSaveDeferredItem |
|