Gets the redis client
@return \Redis the redis client
422865
public function getClient()
	{
		if ($this->_client === null) {
			$this->_client = new \Redis;
			$this->_client->connect($this->hostname, $this->port, $this->database);
			$slaveenable = false;
			if ($this->enableSlaves) {
				while(count($this->slaves)>0){
					$this->_slave = new \Redis();
					$select_slave = self::getByWeight($this->slaves);//随机访问一台redis从服务器
					$slaveenable = $this->_slave->connect($select_slave['hostname'], $select_slave['port'], $this->database);
					if ($slaveenable) {
						if (isset($select_slave['password'])) {
							if ($this->_slave->auth($select_slave['password']) === false) {
								throw new InvalidConfigException('Redis Slave authentication failed!');
							}
						}
						break;
					}			
				}
			}
			if (!$slaveenable) {
				$this->_slave = $this->_client;
				$this->enableSlaves = false;
			}
			if (isset($this->password)) {
				if ($this->_client->auth($this->password) === false) {
					throw new InvalidConfigException('Redis authentication failed!');
				}
			}
			//$this->_client->select($this->database);
		}
		return $this->_client;
	}
1247211
public function getHttpClient()
    {
        if (!is_null($this->httpClient)) {
            return $this->httpClient;
        }

        return $this->httpClient = new Client([
            'base_uri' => $this->storageUrl(),
            'headers' => [
                'X-Auth-Token' => $this->token(),
            ],
        ]);
    }
687328
public static function getInstance($name = 'default')
    {
        if (isset(self::$instance[$name])) {
            return self::$instance[$name];
        }

        $config = Registry::get('config');
        $config = $config['redis'];
        if (!isset($config[$name], $config[$name]['host'])) {
            throw new ConfigException('No redis config!');
        }

        $config = $config[$name];
        $connectType = isset($config['pconnect']) && $config['pconnect'] ? 'pconnect' : 'connect';

        $redis = new self;
        if (!$redis->$connectType(
            $config['host'],
            isset($config['port']) ? $config['port'] : 6379,
            isset($config['timeout']) ? $config['timeout'] : 1
        )) {
            throw new RedisException('Redis server went away!');
        }

        if (isset($config['prefix'])) {
            $redis->setOption(Redis::OPT_PREFIX, $config['prefix']);
        }

        return self::$instance[$name] = $redis;
    }
412272
protected function client()
    {
        $projectId = $this->config('projectId');
        $projectKey = $this->config('projectKey');
        if (!$projectId || !$projectKey) {
            return null;
        }

        $config = $this->config();
        $client = new Notifier($config);

        return $client;
    }
1064743
public function getClient()
    {
        if (null === $this->client) {
            $this->client = S3Client::factory([
                'version'   => 'latest',
                'region'    => $this->getRegion()
            ]);
        }
        return $this->client;
    }
663676
protected function connect()
        {
            if (!is_null($this->connection)) {
                return $this->connection;
            }
            // $this->connection = fsockopen($this->host, $this->port, $error, $message);
            $remote_socket = 'tcp://'.$this->host.':' . $this->port;
            $this->connection = @stream_socket_client($remote_socket, $errno, $error, 30);
            if ($this->connection === false) {
                throw new Exception("Error making Redis connection: {$error} - {$message}");
            }
            // $this->select($this->database);
            return $this->connection;
        }
743117
protected function getClient() {
		if(!$this->client) {
			$this->client = new Client([
				RequestOptions::VERIFY  => self::$VERIFY_SSL,
				RequestOptions::TIMEOUT => $this->timeout,
			]);
		}
		return $this->client;
	}
1234041
protected function client()
    {
        $apiKey = $this->config('apiKey');
        if (!$apiKey) {
            return null;
        }

        $endpoint = $this->config('endpoint');
        $defaults = $this->config('defaults');
        if ($defaults === null) {
            $defaults = true;
        }
        $client = Client::make($apiKey, $endpoint, $defaults);

        return $client;
    }
474902
public function getClient()
    {
        $client = $this->reduceFirst(function (SearchProviderInterface $provider) {
            return $provider->getClient();
        });

        if (null === $client) {
            throw new \RuntimeException('No provider was able to return a client');
        }

        return $client;
    }
851379
protected function getClient()
	{
		if (!static::$client) {
			static::$client = new \AlgoliaSearch\Client(
				Config::get('search.connections.algolia.config.application_id'),
				Config::get('search.connections.algolia.config.admin_api_key')
			);
		}
		
		return static::$client;
	}
456699
public function get()
    {
        do {
            $response = $this->redis->rpop("job_queue");
            usleep(500);
        } while ($response === null);
        return unserialize($response);
    }
588682
public function getSlaveConnection()
    {
        if (null === $this->slaveConnection) {
            $this->slaveConnection = new \Redis();
            $this->slaveConnection->pconnect(
                $this->config['slave']['HOST'],
                $this->config['slave']['PORT']
            );
        }
        return $this->slaveConnection;
    }
125612
public function getClient($name)
    {
        if (!isset($this->serverArray[$name])) {
            $name   = $this->defaultName;
        }

        if (isset($this->clientArray[$name])) {
            try {
                $this->clientArray[$name]->ping();
            } catch (\RedisException $ex) {
                $this->clientArray[$name] = $this->createClient($this->serverArray[$name]);
            }
            return $this->clientArray[$name];
        }

        $this->clientArray[$name] = $this->createClient($this->serverArray[$name]);
        return $this->clientArray[$name];
    }
343142
public function getOpenedClient()
    {
        if (!isset($this->openedClient)) {
            $this->openedClient = new ServiceClient();
            $this->openedClient->setApiKey($this->getParameter('apiKey'));

            $newClient = new \Zend\Http\Client(
                null,
                [
                    'adapter'       => 'Zend\Http\Client\Adapter\Socket',
                    'sslverifypeer' => false,
                ]
            );

            $this->openedClient->setHttpClient($newClient);
        }

        return $this->openedClient;
    }
755724
protected function getHttpClient()
    {
        if ($this->httpClient === null) {
            $this->httpClient = new Client($this->guzzle);
        }

        return $this->httpClient;
    }
1108217
public function getActiveClient()
    {
        foreach ($this->getClients() as $id => $client) {
            $token = $client->getAccessToken();
            if ($token) {
                return $client;
            }
        }

        return;
    }
998644
public function getClient(): ClientInterface
    {
        if ($this->client === null) {
            $this->client = new Client();
        }

        return $this->client;
    }