Inheritance: extends Neos\Cache\CacheFactory, implements Neos\Cache\CacheFactoryInterface
 /**
  * @test
  */
 public function aDifferentDefaultCacheDirectoryIsUsedForPersistentFileCaches()
 {
     $cacheManager = new CacheManager();
     $factory = new CacheFactory(new ApplicationContext('Testing'), $this->mockEnvironment);
     $factory->injectCacheManager($cacheManager);
     $factory->injectEnvironmentConfiguration($this->mockEnvironmentConfiguration);
     $cache = $factory->create('Persistent_Cache', VariableFrontend::class, FileBackend::class, [], true);
     // We need to create the directory here because vfs doesn't support touch() which is used by
     // createDirectoryRecursively() in the setCache method.
     mkdir('vfs://Temporary/Directory/Cache');
     $this->assertEquals(FLOW_PATH_DATA . 'Persistent/Cache/Data/Persistent_Cache/', $cache->getBackend()->getCacheDirectory());
 }
Esempio n. 2
0
 /**
  * Instantiates the cache for $identifier.
  *
  * @param string $identifier
  * @return void
  */
 protected function createCache($identifier)
 {
     $frontend = isset($this->cacheConfigurations[$identifier]['frontend']) ? $this->cacheConfigurations[$identifier]['frontend'] : $this->cacheConfigurations['Default']['frontend'];
     $backend = isset($this->cacheConfigurations[$identifier]['backend']) ? $this->cacheConfigurations[$identifier]['backend'] : $this->cacheConfigurations['Default']['backend'];
     $backendOptions = isset($this->cacheConfigurations[$identifier]['backendOptions']) ? $this->cacheConfigurations[$identifier]['backendOptions'] : $this->cacheConfigurations['Default']['backendOptions'];
     $persistent = isset($this->cacheConfigurations[$identifier]['persistent']) ? $this->cacheConfigurations[$identifier]['persistent'] : $this->cacheConfigurations['Default']['persistent'];
     $cache = $this->cacheFactory->create($identifier, $frontend, $backend, $backendOptions, $persistent);
     $this->registerCache($cache, $persistent);
 }