Clickalicious\PhpMemAdmin\App::getMemcachedClient PHP Метод

getMemcachedClient() защищенный Метод

Returns an instance of Client for host and port combination.
Автор: Benjamin Carl ([email protected])
protected getMemcachedClient ( string $host, integer $port = Client::DEFAULT_PORT, integer $timeout = null ) : Clickalicious\Memcached\Client
$host string The host to return instance for
$port integer The port to return instance for
$timeout integer The timeout used when connecting
Результат Clickalicious\Memcached\Client A client instance
    protected function getMemcachedClient($host, $port = Client::DEFAULT_PORT, $timeout = null)
    {
        $uuid = $this->uuid($host, $port);
        $clients = $this->getClients();
        // Check if already exists ...
        if (isset($clients[$uuid]) === false) {
            $client = clone $this->getClient();
            $client->host($host)->port($port);
            // Check for custom timeout (maybe required when connecting outside localhost = more latency)
            if (null !== $timeout && true === is_int($timeout) && $timeout >= 0) {
                $client->timeout($timeout);
            }
            $clients[$uuid] = $client;
            $this->setClients($clients);
        } else {
            $client = $this->clients[$uuid];
        }
        return $client;
    }