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

get() public method

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