/** * {@inheritdoc} */ public function contains(CacheKey $key) { $this->calls[__FUNCTION__][] = array('key' => $key); if (isset($this->locks[$key->hash])) { return false; } $this->throwException(__FUNCTION__); return $this->region->contains($key); }
/** * {@inheritdoc} */ public function exists($entity, Criteria $extraConditions = null) { if (null === $extraConditions) { $key = new EntityCacheKey($this->class->rootEntityName, $this->class->getIdentifierValues($entity)); if ($this->region->contains($key)) { return true; } } return $this->persister->exists($entity, $extraConditions); }
/** * {@inheritdoc} */ public function exists($entity, array $extraConditions = array()) { if (empty($extraConditions)) { $key = new EntityCacheKey($this->class->rootEntityName, $this->class->getIdentifierValues($entity)); if ($this->region->contains($key)) { return true; } } return $this->persister->exists($entity, $extraConditions); }
public function testEvictAll() { $key1 = new CacheKeyMock('key.1'); $key2 = new CacheKeyMock('key.2'); $this->assertFalse($this->region->contains($key1)); $this->assertFalse($this->region->contains($key2)); $this->region->put($key1, new CacheEntryMock(array('value' => 'foo'))); $this->region->put($key2, new CacheEntryMock(array('value' => 'bar'))); $this->assertTrue($this->region->contains($key1)); $this->assertTrue($this->region->contains($key2)); $this->region->evictAll(); $this->assertFalse($this->region->contains($key1)); $this->assertFalse($this->region->contains($key2)); }