@@ 327-331 (lines=5) @@ | ||
324 | */ |
|
325 | public function attachItem(CacheItemInterface $item) |
|
326 | { |
|
327 | if(isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
328 | 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.'); |
|
329 | }else{ |
|
330 | $this->itemInstances[$item->getKey()] = $item; |
|
331 | } |
|
332 | } |
|
333 | ||
334 |
@@ 211-215 (lines=5) @@ | ||
208 | /** |
|
209 | * @var ExtendedCacheItemInterface $item |
|
210 | */ |
|
211 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
|
212 | $this->itemInstances[ $item->getKey() ] = $item; |
|
213 | } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
214 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
|
215 | } |
|
216 | ||
217 | if ($this->driverWrite($item) && $this->driverWriteTags($item)) { |
|
218 | $item->setHit(true); |
|
@@ 235-239 (lines=5) @@ | ||
232 | */ |
|
233 | public function saveDeferred(CacheItemInterface $item) |
|
234 | { |
|
235 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
|
236 | $this->itemInstances[ $item->getKey() ] = $item; |
|
237 | }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
238 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
|
239 | } |
|
240 | ||
241 | return $this->deferredList[ $item->getKey() ] = $item; |
|
242 | } |