• Модуль: b24connector
  • Путь к файлу: ~/bitrix/modules/b24connector/lib/cache.php
  • Класс: BitrixB24ConnectorCache
  • Вызов: Cache::remember
static function remember(string $cacheId, int $ttl, callable $callback)
{
	$cachePath = self::CACHE_ROOT . '/' . $cacheId;
	$manager = Application::getInstance()->getCache();
	if ($manager->initCache($ttl, $cacheId, $cachePath))
	{
		$cached = $manager->getVars();
		return $cached['PROXY'];
	}
	else
	{
		$result = $callback();
		$manager->startDataCache();
		$manager->endDataCache(['PROXY' => $result]);
		return $result;
	}
}