• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/page_cache.php
  • Класс: CPageCache
  • Вызов: CPageCache::EndDataCache
function EndDataCache()
{
	if(!$this->bStarted)
		return;
	$this->bStarted = false;

	$arAllVars = ob_get_contents();

	$this->_cache->write($arAllVars, $this->basedir, $this->initdir, $this->filename, $this->ttl);

	if (BitrixMainDataCache::getShowCacheStat())
	{
		$written = 0;
		$path = '';
		if ($this->_cache instanceof BitrixMainDataICacheEngineStat)
		{
			$written = $this->_cache->getWrittenBytes();
			$path = $this->_cache->getCachePath();
		}
		elseif ($this->_cache instanceof ICacheBackend)
		{
			/** @noinspection PhpUndefinedFieldInspection */
			$written = $this->_cache->written;

			/** @noinspection PhpUndefinedFieldInspection */
			$path = $this->_cache->path;
		}
		BitrixMainDiagCacheTracker::addCacheStatBytes($written);
		BitrixMainDiagCacheTracker::add($written, $path, $this->basedir, $this->initdir, $this->filename, "W");
	}

	if($arAllVars <> '')
		ob_end_flush();
	else
		ob_end_clean();
}