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
 /**
  * @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();
 }
 /**
  * Sets a reference to the cache frontend which uses this backend and
  * initializes the default cache directory.
  *
  * This method also detects if this backend is frozen and sets the internal
  * flag accordingly.
  *
  * @param FrontendInterface $cache The cache frontend
  * @return void
  * @throws Exception
  */
 public function setCache(FrontendInterface $cache)
 {
     parent::setCache($cache);
     if (is_file($this->cacheDirectory . 'FrozenCache.data')) {
         $this->frozen = true;
         $cachePathAndFileName = $this->cacheDirectory . 'FrozenCache.data';
         $lock = new Lock($cachePathAndFileName, false);
         $data = file_get_contents($cachePathAndFileName);
         $lock->release();
         if ($this->useIgBinary === true) {
             $this->cacheEntryIdentifiers = igbinary_unserialize($data);
         } else {
             $this->cacheEntryIdentifiers = unserialize($data);
         }
     }
 }