public function flushCacheState()
{
if (!empty($this->newCacheState) && is_writable($this->cacheDir)) {
$fullCacheMap = $this->newCacheState + $this->cacheState;
$cachePath = substr(var_export($this->cacheDir, true), 1, -1);
$rootPath = substr(var_export($this->appDir, true), 1, -1);
$cacheData = '<?php return ' . var_export($fullCacheMap, true) . ';';
$cacheData = strtr($cacheData, array('\'' . $cachePath => 'AOP_CACHE_DIR . \'', '\'' . $rootPath => 'AOP_ROOT_DIR . \''));
$fullCacheFileName = $this->cacheDir . self::CACHE_FILE_NAME;
file_put_contents($fullCacheFileName, $cacheData, LOCK_EX);
// For cache files we don't want executable bits by default
chmod($fullCacheFileName, $this->fileMode & ~0111);
if (function_exists('opcache_invalidate')) {
opcache_invalidate($fullCacheFileName, true);
}
$this->cacheState = $this->newCacheState + $this->cacheState;
$this->newCacheState = [];
}
}