• Модуль: rest
  • Путь к файлу: ~/bitrix/modules/rest/lib/eventoffline.php
  • Класс: BitrixRestEventOfflineTable
  • Вызов: EventOfflineTable::checkSendTime
static function checkSendTime($id, $timeout = null) : bool
{
	$result = false;
	$timeout = !is_null($timeout) ? (int)$timeout : static::OFFLINE_EVENT_DEFAULT_TIMEOUT;

	if ($timeout > 0)
	{
		$key = static::OFFLINE_EVENT_CACHE_PREFIX. '|' . $id . '|'. $timeout;
		$cache = Cache::createInstance();
		if ($cache->initCache($timeout, $key))
		{
			$result = false;
		}
		elseif ($cache->startDataCache())
		{
			$result = true;
			$data = 1;
			$cache->endDataCache($data);
		}
	}
	elseif (static::$isSendOfflineEvent === false)
	{
		static::$isSendOfflineEvent = true;
		$result = true;
	}

	return $result;
}