/** * Initializes the cache manager * * @return void * @author Robert Lemke <*****@*****.**> * @internal */ public function initialize() { foreach ($this->cacheConfigurations as $identifier => $configuration) { if ($identifier !== 'default') { $frontend = isset($configuration['frontend']) ? $configuration['frontend'] : $this->cacheConfigurations['default']['frontend']; $backend = isset($configuration['backend']) ? $configuration['backend'] : $this->cacheConfigurations['default']['backend']; $backendOptions = isset($configuration['backendOptions']) ? $configuration['backendOptions'] : $this->cacheConfigurations['default']['backendOptions']; $this->cacheFactory->create($identifier, $frontend, $backend, $backendOptions); } } }
/** * Create a new cache. * * @param string $cacheIdentifier The cache identifier. * @param string $frontendName The class name of the cache frontend. * @return t3lib_cache_frontend_FrontendInterface The cache frontend. * @see t3lib_cache_Factory::create() * @author Romain Ruetschi <*****@*****.**> */ public function createCache($cacheIdentifier, $frontendName = 't3lib_cache_frontend_VariableFrontend') { return $this->cacheFactory->create($cacheIdentifier, $frontendName, $this->getCacheBackend($cacheIdentifier), $this->getCacheOptions($cacheIdentifier)); }
/** * @test * @author Robert Lemke <*****@*****.**> * @author Karsten Dambekalns <*****@*****.**> * @author Ingo Renner <*****@*****.**> */ public function createPassesBackendOptionsToTheCreatedBackend() { $someValue = microtime(); $backendOptions = array('someOption' => $someValue); $cache = $this->getMock('t3lib_cache_frontend_VariableFrontend', array(), array(), '', FALSE); $mockCacheManager = $this->getMock('t3lib_cache_Manager', array('registerCache'), array(), '', FALSE); $factory = new t3lib_cache_Factory(); $factory->setCacheManager($mockCacheManager); $cache = $factory->create('TYPO3_Cache_FactoryTest_Cache', 't3lib_cache_frontend_VariableFrontend', 't3lib_cache_backend_MockBackend', $backendOptions); $this->assertEquals($someValue, $cache->getBackend()->getSomeOption(), 'create() did not pass the backend options to the backend.'); }
/** * Initializes the cache manager * * @return void * @author Robert Lemke <*****@*****.**> * @internal */ public function initialize() { foreach ($this->cacheConfigurations as $identifier => $configuration) { $this->cacheFactory->create($identifier, $configuration['frontend'], $configuration['backend'], $configuration['backendOptions']); } }