Jenner\SimpleFork\Cache\RedisCache::get PHP Метод

get() публичный Метод

get var
public get ( $key, null $default = null ) : boolean | string | null
$key
$default null
Результат boolean | string | null
    public function get($key, $default = null)
    {
        $result = $this->redis->hGet($this->prefix, $key);
        if ($result !== false) {
            return $result;
        }
        return $default;
    }

Usage Example

Пример #1
0
 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();
 }