Add a serer to the server pool

@param   string  $host
@param   int     $port
@param   int     $weight
@return  boolean
431552
public function addServer($host, $port = 11211, $weight = 0)
    {
        $key = $this->getServerKey($host, $port, $weight);
        if (isset($this->server[$key])) {
            // Dup
            $this->resultCode = Memcached::RES_FAILURE;
            $this->resultMessage = 'Server duplicate.';
            return false;

        } else {
            $this->server[$key] = array(
                'host'  => $host,
                'port'  => $port,
                'weight'    => $weight,
            );

            $this->connect();
            return true;
        }
    }
1136412
public function mount($host, $port, $user, $password, $dbname)
    {
        $query = 'INSERT INTO sbas (ord, host, port, dbname, sqlengine, user, pwd)
              SELECT COALESCE(MAX(ord), 0) + 1 AS ord, :host AS host, :port AS port, :dbname AS dbname,
                     "MYSQL" AS sqlengine, :user AS user, :password AS pwd FROM sbas';

        $statement = $this->connection->prepare($query);
        $statement->execute([
            ':host'     => $host,
            ':port'     => $port,
            ':dbname'   => $dbname,
            ':user'     => $user,
            ':password' => $password
        ]);

        $statement->closeCursor();

        return $this->find((int) $this->connection->lastInsertId());
    }
562717
public final void addServer(final String server, final int port, int weight) throws IOException {
    if (weight <= 0) {
      throw new IllegalArgumentException("weight<=0");
    }
    this.checkServerPort(server, port);
    this.connect(new InetSocketAddressWrapper(this.newSocketAddress(server, port),
        this.serverOrderCount.incrementAndGet(), weight, null));
  }
1348747
public function setProxy($host = null, $port = null)
    {
        parent::setProxy($host, $port);

        if ($this->curl) {
            if ($this->proxyHost) {
                curl_setopt($this->curl, CURLOPT_PROXY, $this->proxyHost);
                curl_setopt($this->curl, CURLOPT_PROXYPORT, $this->proxyPort);
            } else {
                curl_setopt($this->curl, CURLOPT_PROXY, '');
            }
        }
    }
970373
public function addWeightFunction(float $weight, AbstractQuery $filter = null): self
    {
        return $this->addFunction('weight', $weight, $filter);
    }
1223403
public function addRedisServer($host, $port = 6379, $db = 0, $timeout = 5, $auth = '') {
		$this->settings = [
			'host'    => $host,
			'port'    => $port,
			'db'      => $db,
			'timeout' => $timeout,
			'auth'    => $auth
		];
	}
1178696
public function setServer($host, $port = 0)
    {
        assert(is_string($host));
        if ($host[0] == '/') {
            $this->_path = 'unix://'.$host;

            return;
        }
        if (substr($host, 0, 7) == 'unix://') {
            $this->_path = $host;

            return;
        }

        $this->_host = $host;
        if (is_int($port)) {
            if ($port) {
                $this->_port = $port;
            }
        }
        $this->_path = '';

        return $this;
    }
1102703
public synchronized boolean addPool(HostConnectionPool<CL> pool) {
        if (this.pools.add(pool)) {
            refresh();
            return true;
        }
        return false;
    }
235186
public function addHost(Host $host)
    {
        if (empty($host)) return $this;

        $this->_host_list["{$host->name}:{$host->port}"] = $host;

        return $this;
    }
30795
public function connect($host = null, $port = null)
    {
        $this->_host = null !== $host ? $host : $this->_host;
        $this->_port = null !== $port ? $port : $this->_port;
        if (false === $this->_ssh_resource = ssh2_connect($this->_host, $this->_port)) {
            throw new TransportException(sprintf('Enable to connect to %s:%i.', $this->_host, $this->_port));
        }

        return $this;
    }
54135
public function insert($data, $weight = 0)
    {
        if ($this->isEmpty()) {
            $this->_nodes[] = ['data' => $data, 'weight' => $weight];
            return $this;
        }

        $inserted = false;
        $new = [];
        while(count($this->_nodes) > 0) {
            $element = array_shift($this->_nodes);
            if (
                !$inserted &&
                $this->compare((int) $weight, $element['weight']) <= 0
            ) {
                $new[] = ['data' => $data, 'weight' => (int) $weight];
                $new[] = ['data' => $element['data'], 'weight' => $element['weight']];
                $inserted = true;
            } else {
                $new[] = ['data' => $element['data'], 'weight' => $element['weight']];
            }
        }
        if (!$inserted) {
            $new[] = ['data' => $data, 'weight' => $weight];
        }
        $this->_nodes = $new;
        return $this;
    }
615721
protected function setHostAndPort($host)
    {
        if (!str_contains($host, ':')) {
            $this->host = $host;
        } else {
            list($this->host, $this->port) = explode(':', $host);

            $this->port = (int) $this->port;
        }
    }
49546
public static function useProxy($host, $port, $username = null, $password = null) {
    Connect2PayCurrencyHelper::$proxy_host = $host;
    Connect2PayCurrencyHelper::$proxy_port = $port;
    Connect2PayCurrencyHelper::$proxy_username = $username;
    Connect2PayCurrencyHelper::$proxy_password = $password;
  }
1008132
public function devServer(string $host, int $port)
    {
        // Mark server mode
        define('SERVER_MODE', 'buildin');

        $this->config['host'] = $host;
        $this->config['port'] = $port;

        $this->printServerFinger();

        // Start cli Development Server
        $bind_http = $host . ':' . $port;
        passthru("php -S {$bind_http} -t " . APP_PATH . "/public");
    }
1077466
public function addServer($host, $port = 11211, $weight = 1)
    {
        $this->memcached->addServer($host, $port, $weight);

        return $this;
    }
1112372
private boolean validateServer(String host, int port){
        if(host==null || host.isEmpty()){
            return false;
        }
        if(port <=0 || port > 65535){
            return false;
        }
        return true;
    }
320052
public function mount($host, $port, $user, $password, $dbname)
    {
        $databox = $this->repository->mount($host, $port, $user, $password, $dbname);

        $this->clearCache();

        return $databox;
    }