Odesk\Phystrix\RequestCache::exists PHP Method

exists() public method

Returns true, if specified cache key exists
public exists ( string $commandKey, string $cacheKey ) : boolean
$commandKey string
$cacheKey string
return boolean
    public function exists($commandKey, $cacheKey)
    {
        return array_key_exists($commandKey, $this->cachedResults) && array_key_exists($cacheKey, $this->cachedResults[$commandKey]);
    }

Usage Example

Example #1
0
 public function testExists()
 {
     $result = (object) array('a' => 123);
     $this->assertFalse($this->requestCache->exists('TestCommand', 'cache-key-123'));
     $this->requestCache->put('TestCommand', 'cache-key-123', $result);
     $this->assertTrue($this->requestCache->exists('TestCommand', 'cache-key-123'));
 }
All Usage Examples Of Odesk\Phystrix\RequestCache::exists