Phalcon\Test\Unit\Cache\Backend\RedisCest::get PHP Method

get() public method

public get ( UnitTester $I )
$I UnitTester
    public function get(UnitTester $I)
    {
        $I->wantTo('Get data by using Redis as cache backend');
        $key = '_PHCR' . 'data-get';
        $data = [uniqid(), gethostname(), microtime(), get_include_path(), time()];
        $cache = new Redis(new Data(['lifetime' => 20]), ['host' => TEST_RS_HOST, 'port' => TEST_RS_PORT]);
        $I->haveInRedis('string', $key, serialize($data));
        $I->assertEquals($data, $cache->get('data-get'));
        $I->assertNull($cache->get($key));
        $data = 'sure, nothing interesting';
        $I->haveInRedis('string', $key, serialize($data));
        $I->assertEquals($data, $cache->get('data-get'));
        $I->assertNull($cache->get($key));
    }