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

save() public method

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