create() public méthode

public create ( string $cacheIdentifier, string $cacheObjectName, string $backendObjectName, array $backendOptions = [], boolean $persistent = false ) : Frontend\FrontendInterface
$cacheIdentifier string
$cacheObjectName string
$backendObjectName string
$backendOptions array
$persistent boolean
Résultat Frontend\FrontendInterface
Exemple #1
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);
 }
 /**
  * @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());
 }