Jenner\SimpleFork\Cache\RedisCache::delete PHP Method

delete() public method

delete var
public delete ( $key ) : boolean
$key
return boolean
    public function delete($key)
    {
        if ($this->redis->hDel($this->prefix, $key) > 0) {
            return true;
        }
        return false;
    }

Usage Example

 public function testAll()
 {
     if (!extension_loaded("Redis")) {
         $this->markTestSkipped("Redis extension is not loaded");
     }
     $this->cache = new Jenner\SimpleFork\Cache\RedisCache();
     $this->cache->set('cache', 'test');
     $this->assertTrue($this->cache->has('cache'));
     $this->assertEquals($this->cache->get('cache'), 'test');
     $this->assertTrue($this->cache->delete('cache'));
     $this->assertNull($this->cache->get('cache'));
     $this->cache->close();
 }