예제 #1
0
 public function dataIgbinary(UnitTester $I)
 {
     if (!extension_loaded('igbinary')) {
         throw new \PHPUnit_Framework_SkippedTestError('Warning: igbinary extension is not loaded');
     }
     $I->wantTo("Use File cache with Igbinary frontend");
     $frontend = new Igbinary(['lifetime' => 600]);
     $backend = new File($frontend, ['cacheDir' => PATH_CACHE, 'prefix' => 'igbinary_']);
     $I->assertFalse($backend->isStarted());
     $backend->save('test-data', 'nothing interesting');
     $I->amInPath(PATH_CACHE);
     $I->seeFileFound('igbinary_' . $backend->getKey('test-data'));
     $I->seeFileContentsEqual(igbinary_serialize('nothing interesting'));
     $I->assertEquals('nothing interesting', $backend->get('test-data'));
     $backend->save('test-data', 'something interesting');
     $I->assertEquals('something interesting', $backend->get('test-data'));
     $data = ['null' => null, 'array' => [1, 2, 3, 4 => 5], 'string', 123.45, 6, true, false, null, 0, ""];
     $serialized = igbinary_serialize($data);
     $I->assertEquals($data, igbinary_unserialize($serialized));
     $backend->save('test-data', $data);
     $I->assertEquals($data, $backend->get('test-data'));
     $I->assertTrue($backend->exists('test-data'));
     $I->assertTrue($backend->delete('test-data'));
     // Delete cache
     $I->dontSeeFileFound('igbinary_' . $backend->getKey('test-data'));
 }
예제 #2
0
파일: File.php 프로젝트: mattvb91/cphalcon
 public function getKey($key)
 {
     return parent::getKey($key);
 }