/** * 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); } }
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()); }
public function testMakeWithoutNamespaceMakesAdapterWithDefaultNamespace() { $cache = CacheFactory::make(); $this->assertSame('default', $cache->getNamespace()); }