In some cases, the cache layer would return values even if those values should not have been returned because their tags had been invalidated.
This could happen if you would call
$this->cache->getCacheItem($cacheKey);
without wrapping that call inside an if block
if ($this->cache->hasItem($cacheKey)) { }
Now getCacheItem() will no longer return a result if the item is invalidated, so it is no longer necessary to check with hasItem().
In some cases, the cache layer would return values even if those values should not have been returned because their tags had been invalidated. This could happen if you would call
$this->cache->getCacheItem($cacheKey);
without wrapping that call inside an if blockif ($this->cache->hasItem($cacheKey)) { }
Now
getCacheItem()
will no longer return a result if the item is invalidated, so it is no longer necessary to check withhasItem()
.