@param string $host
@param int $port
@throws BadMethodCallException

@return \Doctrine\Common\Cache\MemcacheCache
496268
private static function configureMemcacheCache($host = '127.0.0.1', $port = 11211)
    {
        if (!extension_loaded('memcache')) {
            throw new \BadMethodCallException('MemcacheCache configured but module \'memcache\' not loaded.');
        }

        $memcache = new \Memcache();
        $memcache->addserver($host, $port);

        $cache = new \Doctrine\Common\Cache\MemcacheCache();
        $cache->setMemcache($memcache);

        return $cache;
    }
1158975
public function setServer($host, $port = 6379)
    {
        $this->host = $host;
        $this->port = $port ? $port : $this->port;
    }
805498
public function make($host)
    {
        $host = $this->resolver->resolve($host, '/');
        $hash = md5($host);

        if (isset($this->instances[$hash])) {
            return $this->instances[$hash];
        }

        $dir = sprintf(
            '%s/%s',
            rtrim($this->cacheDir, '/'),
            $hash
        );
        $instance = new Loader(
            new FileCache(sprintf(
                '%s/definitions.php',
                $dir
            )),
            $this->resolver,
            $this->builder,
            $this->http,
            $this->validator
        );
        $this->instances[$hash] = $instance;

        return $instance;
    }
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;
  }
231421
public static function getInstance($host = '127.0.0.1', $port = 11211)
    {
        return \Webiny\Component\Cache\Bridge\Memcache::getInstance($host, $port);
    }
584105
public function setProxy($host = null, $port = null)
    {
        $this->downloader->setProxy($host, $port);
    }
153779
public function addServer($ip = '127.0.0.1', $port = 11211)
    {
        if (!$this->serverVerifier->verify($ip, $port)) {
            return false;
        }

        if ($status = $this->memcache->addServer($ip, $port)) {
            $this->safe = true;
        }

        return $status;
    }
167127
private static function createSocket($host, $port, $sendTimeout, $receiveTimeout)
    {
        $socket = new TSocket($host, $port, true);
        if (null !== $sendTimeout) {
            $socket->setSendTimeout($sendTimeout);
        }

        if (null !== $receiveTimeout) {
            $socket->setRecvTimeout($receiveTimeout);
        }

        return $socket;
    }
189689
public function setDefaultHost($host, $port = null) {
		$this->defaultHost = (string) $host;
		
		if ($port !== null) {
			$this->setDefaultPort($port);
		}
		
		return $this;
	}
418556
public function connect($host = '127.0.0.1', $port = 11211)
    {
        if (!isset($this->servers[$host . ':' . $port])) {
            $this->server = new \Memcache();
            $this->server->connect($host, $port);

            $this->servers[$host . ':' . $port] = $this->server;
        } else {
            $this->server = $this->servers[$host . ':' . $port];
        }

        return true;
    }
1018937
public static function Redis($host = '127.0.0.1', $port = 6379, $options = [])
    {
        return new CacheStorage(Storage\Redis::getInstance($host, $port), $options);
    }
413778
public static function create($host, $cacheDir = null, EventManager $eventManager = null)
    {
        $cache = $cacheDir ?: sys_get_temp_dir();
        $client = ClientBuilder::create()
            ->addConnection('default', $host)
            ->build();

        return new self($client, $cache, $eventManager);
    }
956483
public static function getInstance($host = 'localhost', $port = 6379)
    {
        return \Webiny\Component\Cache\Bridge\Redis::getInstance($host, $port);
    }
336382
public function connect($host, $port = 80, $secure = false)
    {
        $this->log("Connecting to: ${host}:${port}");
        return parent::connect($host, $port, $secure);
    }
1373593
public function connectUdp($host, $port)
    {
        $this->type = 'udp';
        $pton = @inet_pton($host);
        if ($pton === false) { // dirty check
            \PHPDaemon\Clients\DNS\Pool::getInstance()->resolve($host, function ($result) use ($host, $port) {
                if (!$result) {
                    Daemon::log(get_class($this) . '->connectUdp : unable to resolve hostname: ' . $host);
                    $this->onStateEv($this->bev, \EventBufferEvent::ERROR);
                    return;
                }
                // @todo stack of addrs
                if (is_array($result)) {
                    srand(Daemon::$process->getPid());
                    $real = $result[rand(0, sizeof($result) - 1)];
                    srand();
                } else {
                    $real = $result;
                }
                $this->connectUdp($real, $port);
            });
            return true;
        }
        $this->hostReal = $host;
        if ($this->host === null) {
            $this->host = $this->hostReal;
        }
        $l = mb_orig_strlen($pton);
        if ($l === 4) {
            $this->addr = $host . ':' . $port;
            /* @TODO: use EventUtil::SOCK_DGRAM */
            $fd = socket_create(\EventUtil::AF_INET, SOCK_DGRAM, \EventUtil::SOL_UDP);
        } elseif ($l === 16) {
            $this->addr = '[' . $host . ']:' . $port;
            $fd = socket_create(\EventUtil::AF_INET6, SOCK_DGRAM, \EventUtil::SOL_UDP);
        } else {
            return false;
        }
        if (!$fd) {
            return false;
        }
        socket_set_nonblock($fd);
        @socket_connect($fd, $host, $port);
        socket_getsockname($fd, $this->locAddr, $this->locPort);
        $this->setFd($fd);
        if (!$this->bev) {
            return false;
        }
        return true;
    }
501063
public function flush($host = null): Process
    {
        $host = $this->getHosts($host);

        $command = $this->generateBanCommand($host);

        return $this->executeCommand($command);
    }
950814
private function initializeMemCache()
    {
        $this->memcache = new \Memcache();

        // support multiple hosts using semicolon to separate hosts
        $hosts = explode(';', $this->host);

        // different ports for each hosts the same way
        $ports = explode(';', $this->port);

        if (count($ports) < 1) {
            $ports = array_fill(0, count($hosts), self::DEFAULT_PORT);
        } elseif (count($ports) === 1) {
            // if we have just one port, use it for all hosts
            $usedPort = $ports[0];
            $ports    = array_fill(0, count($hosts), $usedPort);
        }

        foreach ($hosts as $i => $host) {
            if (!isset($ports[$i])) {
                /*
                 * if we have a difference between the count of hosts and
                 * the count of ports, use the default port to fill the gap
                 */
                $ports[$i] = self::DEFAULT_PORT;
            }

            $this->memcache->addServer($host, $ports[$i]);
        }
    }