• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/data/configurator/memcacheconnectionconfigurator.php
  • Класс: BitrixMainDataConfiguratorMemcacheConnectionConfigurator
  • Вызов: MemcacheConnectionConfigurator::addServers
protected function addServers($config)
{
	$servers = $config['servers'] ?? [];

	if (isset($config['host'], $config['port']))
	{
		array_unshift($servers, [
			'host' => $config['host'],
			'port' => $config['port'],
		]);
	}

	foreach ($servers as $server)
	{
		if (!isset($server['weight']) || $server['weight'] <= 0)
		{
			$server['weight'] = 1;
		}

		$this->servers[] = [
			'host' => $server['host'] ?? 'localhost',
			'port' => $server['port'] ?? '11211',
			'weight' => $server['weight'],
		];
	}

	return $this;
}