- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/data/cache.php
- Класс: BitrixMainDataCache
- Вызов: Cache::endDataCache
public function endDataCache($vars = false)
{
if (!$this->isStarted)
{
return;
}
$this->isStarted = false;
$data = [
'CONTENT' => $this->hasOutput ? ob_get_contents() : '',
'VARS' => ($vars !== false ? $vars : $this->vars),
];
$this->cacheEngine->write($data, $this->baseDir, $this->initDir, $this->filename, $this->ttl);
if (static::$showCacheStat)
{
$written = 0;
$path = '';
if ($this->cacheEngine instanceof ICacheEngineStat)
{
$written = $this->cacheEngine->getWrittenBytes();
$path = $this->cacheEngine->getCachePath();
}
elseif ($this->cacheEngine instanceof ICacheBackend)
{
/** @noinspection PhpUndefinedFieldInspection */
$written = $this->cacheEngine->written;
/** @noinspection PhpUndefinedFieldInspection */
$path = $this->cacheEngine->path;
}
DiagCacheTracker::addCacheStatBytes($written);
DiagCacheTracker::add($written, $path, $this->baseDir, $this->initDir, $this->filename, 'W');
}
if ($this->hasOutput)
{
if (ob_get_contents() <> '')
{
ob_end_flush();
}
else
{
ob_end_clean();
}
}
}