| @@ 326-330 (lines=5) @@ | ||
| 323 | */ |
|
| 324 | public function attachItem(CacheItemInterface $item) |
|
| 325 | { |
|
| 326 | if(isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
| 327 | 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.'); |
|
| 328 | }else{ |
|
| 329 | $this->itemInstances[$item->getKey()] = $item; |
|
| 330 | } |
|
| 331 | } |
|
| 332 | ||
| 333 | ||
| @@ 192-196 (lines=5) @@ | ||
| 189 | /** |
|
| 190 | * @var ExtendedCacheItemInterface $item |
|
| 191 | */ |
|
| 192 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
|
| 193 | $this->itemInstances[ $item->getKey() ] = $item; |
|
| 194 | } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
| 195 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
|
| 196 | } |
|
| 197 | ||
| 198 | ||
| 199 | if ($this->driverWrite($item) && $this->driverWriteTags($item)) { |
|
| @@ 216-220 (lines=5) @@ | ||
| 213 | */ |
|
| 214 | public function saveDeferred(CacheItemInterface $item) |
|
| 215 | { |
|
| 216 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
|
| 217 | $this->itemInstances[ $item->getKey() ] = $item; |
|
| 218 | }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
| 219 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
|
| 220 | } |
|
| 221 | ||
| 222 | return $this->deferredList[ $item->getKey() ] = $item; |
|
| 223 | } |
|