Neos\Cache\Backend\SimpleFileBackend::setCache PHP Method

setCache() public method

Sets a reference to the cache frontend which uses this backend and initializes the default cache directory.
public setCache ( Neos\Cache\Frontend\FrontendInterface $cache ) : void
$cache Neos\Cache\Frontend\FrontendInterface The cache frontend
return void
    public function setCache(FrontendInterface $cache)
    {
        parent::setCache($cache);
        $this->cacheEntryFileExtension = $cache instanceof PhpFrontend ? '.php' : '';
        $this->configureCacheDirectory();
    }

Usage Example

 /**
  * @test
  * @expectedException \Neos\Cache\Exception
  */
 public function setCacheThrowsExceptionOnNonWritableDirectory()
 {
     $mockEnvironmentConfiguration = $this->getMockBuilder(EnvironmentConfiguration::class)->setMethods(null)->setConstructorArgs([__DIR__ . '~Testing', 'vfs://Some/NonExisting/Directory/', 1024])->getMock();
     $simpleFileBackend = new SimpleFileBackend($mockEnvironmentConfiguration, []);
     $simpleFileBackend->setCache($this->mockCacheFrontend);
     $this->getSimpleFileBackend();
 }
All Usage Examples Of Neos\Cache\Backend\SimpleFileBackend::setCache