Phalcon\Test\Unit\Cache\Backend\ApcCest::flushByPrefix PHP Method

flushByPrefix() public method

public flushByPrefix ( UnitTester $I )
$I UnitTester
    public function flushByPrefix(UnitTester $I)
    {
        $I->wantTo('Flush prefixed keys from cache by using APC(u) as cache backend');
        $prefix = 'app-data';
        $cache = new Apc(new Data(['lifetime' => 20]), ['prefix' => $prefix]);
        $key1 = '_PHCA' . 'app-data' . 'data-flush-1';
        $key2 = '_PHCA' . 'app-data' . 'data-flush-2';
        $key3 = '_PHCA' . 'data-flush-3';
        $I->haveInApc([$key1 => 1, $key2 => 2, $key3 => 3], null);
        $I->assertTrue($cache->flush());
        $I->dontSeeInApc($key1);
        $I->dontSeeInApc($key2);
        $I->assertEquals(3, $I->grabValueFromApc($key3));
    }