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

save() public method

public save ( UnitTester $I )
$I UnitTester
    public function save(UnitTester $I)
    {
        $I->wantTo('Save data by using Memcache as cache backend');
        $key = 'data-save';
        $data = [uniqid(), gethostname(), microtime(), get_include_path(), time()];
        $cache = new Memcache(new Data(['lifetime' => 20]), ['host' => TEST_MC_HOST, 'port' => TEST_MC_PORT]);
        $I->dontSeeInMemcached($key);
        $cache->save('data-save', $data);
        $I->seeInMemcached($key, serialize($data));
        $data = 'sure, nothing interesting';
        $I->dontSeeInMemcached('non-existent-key', serialize($data));
        $cache->save('data-save', $data);
        $I->seeInMemcached($key, serialize($data));
        $I->clearMemcache();
    }