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

setCache() public method

Initializes the identifier prefix when setting the cache.
public setCache ( Neos\Cache\Frontend\FrontendInterface $cache ) : void
$cache Neos\Cache\Frontend\FrontendInterface
return void
    public function setCache(FrontendInterface $cache)
    {
        parent::setCache($cache);
        $pathHash = substr(md5($this->environmentConfiguration->getApplicationIdentifier() . $this->environmentConfiguration->getApplicationContext() . $cache->getIdentifier()), 0, 12);
        $this->identifierPrefix = 'Flow_' . $pathHash . '_';
    }

Usage Example

 /**
  * Sets up the APC backend used for testing
  *
  * @return ApcBackend
  */
 protected function setUpBackend()
 {
     $cache = $this->createMock(FrontendInterface::class);
     $backend = new ApcBackend($this->getEnvironmentConfiguration(), []);
     $backend->setCache($cache);
     return $backend;
 }