• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/bot.php
  • Класс: BitrixImBot
  • Вызов: Bot::getChatListCache
static function getChatListCache($botId)
{
	$botId = intval($botId);
	if ($botId <= 0)
		return Array();

	$cache = BitrixMainDataCache::createInstance();
	if($cache->initCache(self::CACHE_TTL, 'chat'.$botId, self::CACHE_PATH))
	{
		$result = $cache->getVars();
	}
	else
	{
		$result = Array();
		$orm = BitrixImModelBotChatTable::getList(Array(
			'filter' => Array('=BOT_ID' => $botId)
		));
		while ($row = $orm->fetch())
		{
			$result[$row['CHAT_ID']] = $row;
		}

		$cache->startDataCache();
		$cache->endDataCache($result);
	}

	return $result;
}