Odesk\Phystrix\RequestCache::clear PHP Method

clear() public method

Clears the cache for a given cacheKey, for a given commandKey
public clear ( string $commandKey, string $cacheKey )
$commandKey string
$cacheKey string
    public function clear($commandKey, $cacheKey)
    {
        if ($this->exists($commandKey, $cacheKey)) {
            unset($this->cachedResults[$commandKey][$cacheKey]);
        }
    }

Usage Example

示例#1
0
 public function testClear()
 {
     $result = (object) array('a' => 123);
     $this->requestCache->put('TestCommand', 'cache-key-123', $result);
     $this->assertEquals($result, $this->requestCache->get('TestCommand', 'cache-key-123'));
     $this->requestCache->clear('TestCommand', 'cache-key-123');
     $this->assertNull($this->requestCache->get('TestCommand', 'cache-key-123'));
 }