public function it_should_cache_has() { $this->cache->has($path = 'path.txt')->willReturn(null); $this->adapter->has($path)->willReturn(true); $this->cache->updateObject($path, compact('path'), true)->shouldBeCalled(); $this->has($path)->shouldBe(true); }
/** * {@inheritdoc} */ public function has($path) { $cacheHas = $this->cache->has($path); if ($cacheHas !== null) { return $cacheHas; } $adapterResponse = $this->adapter->has($path); if (!$adapterResponse) { $this->cache->storeMiss($path); } else { $cacheEntry = is_array($adapterResponse) ? $adapterResponse : compact('path'); $this->cache->updateObject($path, $cacheEntry, true); } return $adapterResponse; }