예제 #1
0
 public function testApplicationConfigCacheIsFaster()
 {
     if (!extension_loaded('apc') || !ini_get('apc.enable_cli')) {
         $this->markTestSkipped('The ' . __CLASS__ . ' requires apc extension with apc.enable_cli=1.');
     }
     $libPath = dirname(dirname(dirname(dirname(dirname(__DIR__)))));
     $appPath = $libPath . "/tests/fixtures/app";
     Generic::clearConfigCache();
     $this->assertFalse(apc_exists(Generic::CACHE_KEY));
     $stopwatch = new Stopwatch();
     $stopwatch->start('noCache');
     $app = new Generic($appPath, $libPath, '', '', '');
     $noCache = $stopwatch->stop('noCache');
     $app = null;
     $app = new Generic($appPath, $libPath, '', '', '', true);
     $app = null;
     $stopwatch->start('cache');
     $app = new Generic($appPath, $libPath, '', '', '', true);
     $cache = $stopwatch->stop('cache');
     $this->assertLessThan($noCache->getDuration(), $cache->getDuration());
     $this->assertInstanceOf('Pimple', $app->getApp());
 }
예제 #2
0
 public static function setConfigCache($hash, $config)
 {
     Generic::clearConfigCache();
     return apc_store(Generic::CACHE_KEY, array($hash, $config));
 }