コード例 #1
0
 /**
  * Configures the cache factory.
  *
  * @param \Es\System\SystemEvent $event The system event
  */
 public function configureFactory(SystemEvent $event)
 {
     $systemConfig = $this->getConfig();
     $initialConfig = $systemConfig->getInitialConfig();
     if (isset($initialConfig['cache'])) {
         $cacheConfig = (array) $initialConfig['cache'];
         CacheFactory::setConfig($cacheConfig);
     }
 }
コード例 #2
0
 public function testConfigureFactory()
 {
     $config = ['cache' => ['defaults' => ['adapter' => 'foo', 'options' => ['enabled' => false]], 'adapters' => ['foo' => ['class' => FileCache::CLASS, 'options' => ['basedir' => 'bar', 'hashing_algorithm' => 'crc32']]]]];
     $systemConfig = new SystemConfig($config);
     $listener = new ConfigureCacheListener();
     $listener->setConfig($systemConfig);
     $listener->configureFactory(new SystemEvent());
     $this->assertSame($config['cache'], CacheFactory::getConfig());
 }
コード例 #3
0
 public function testMakeWithoutNamespaceMakesAdapterWithDefaultNamespace()
 {
     $cache = CacheFactory::make();
     $this->assertSame('default', $cache->getNamespace());
 }