Get the client.

@return \Memcached
540107
private function getParentClient()
    {
        $client = AdapterUtil::getPropertyValue($this, 'client');

        return null !== $client ? $client : AdapterUtil::getPropertyValue($this, 'lazyClient');
    }
1125107
public function getCache() {
        if($this->cacheBackend == null) {
            $this->cacheBackend = Zend_Cache::factory('Core', 'Apc', array('automatic_serialization' => true));
        }
        return $this->cacheBackend;
    }
794073
public function getClient()
    {
        if ($this->_client === null) {
            try {
                $s3Client = new Aws\S3\S3Client(
                    [
                        'key' => $this->getKey(),
                        'secret' => $this->getSecret(),
                    ]
                );
            } catch (InvalidArgumentException $e) {
                throw new BuildException($e);
            }

            $this->_client = $s3Client;
        }

        return $this->_client;
    }
66936
public static function getInstance()
    {
        if (null === self::$_instance) {
        
            $app = \Cetera\Application::getInstance();
        
            if ($app->getVar('cache_memcache')!='off' && $app->getVar('cache_memcache')!='disable' && $app->getVar('cache_memcache')!='0' && self::isMemcacheAvailable()) {
				$o = [];
				if ( $app->getVar('memcache_server') ) {
					$o['servers'] = $app->getVar('memcache_server');
				}
                $backend = new \Dklab_Cache_Backend_TagEmuWrapper(new \Zend_Cache_Backend_Memcached($o));
			}
            elseif ($app->getVar('cache_memcached')!='off'&& $app->getVar('cache_memcached')!='disable' && $app->getVar('cache_memcached')!='0' && self::isMemcachedAvailable()) {
				$o = [];
				if ( $app->getVar('memcached_server') ) {
					$o['servers'] = $app->getVar('memcached_server');
				}				
                $backend = new \Dklab_Cache_Backend_TagEmuWrapper(new \Zend_Cache_Backend_Libmemcached($o));				
            } 
			elseif ($app->getVar('cache_file') && self::isFilecacheAvailable()) {
                $backend = new \Zend_Cache_Backend_File(array('cache_dir'=>FILECACHE_DIR, 'hashed_directory_level'=>1));
            } 
			else {
                $backend = new BackendNull();
            }
        
            self::$_instance = new Profiler($backend);
        }
        return self::$_instance;
    }
1107997
protected function getConnection()
    {
        if (empty($this->memcache)) {

            //ini_set('memcache.chunk_size', 32768);
            //ini_set('memcache.allow_failover', false); // default is usually true
            //ini_set('memcache.hash_strategy', 'consistent');

            $this->memcache = new Memcache;

            // Add the servers
            if (!is_array($this->memcachedServers) || count($this->memcachedServers) < 1)
                throw new CacheException('At least one server must be specified.');

            foreach ( $this->memcachedServers as $server ) {
                $options = array_merge(array('port'             => 11211,
                                             'persistent'       => true,
                                             'weight'           => 1,
                                             'timeout'          => 1,
                                             'retry_interval'   => 15,
                                             'status'           => true,
                                             'failure_callback' => null), array_change_key_case($server, CASE_LOWER));

                $this->Logger->debug("Adding memcached server:\n");
                $this->Logger->debug($options);

//                if(!array_key_exists('failure_callback', $options))
//                    $options['failure_callback'] = array(__CLASS__, '_failureCallback');

                if ($this->memcache->addServer($options['host'], $options['port'],
                                            $options['persistent'], $options['weight'],
                                            $options['timeout'], $options['retry_interval'],
                                            $options['status'], $options['failure_callback']) === false) {
                    throw new CacheException("Unable to add memcache server: {$options['host']}");
                }
            }
        }

        return $this->memcache;
    }
1128839
public function getHttpClient()
    {
        if (!$this->_service) {
            $this->_service = new Zend_Gdata_App();
        }
        $client = $this->_service->getHttpClient();
        return $client;
    }
1298248
public function getGuzzleClient()
    {
        $guzzle = $this->guzzleClient;

        if ($this->retry) {
            $guzzle = $this->addRetrySubscriber($guzzle);
        }

        return $guzzle;
    }
1004140
public function build(): Client
    {
        return new Client(
            new CommandBus(
                [
                    new LockingMiddleware(),
                    new ExceptionMiddleware(),
                    new ValidationMiddleware(),
                    new CommandHandlerMiddleware(
                        new ClassNameExtractor(),
                        new CallableLocator($this->getCommandResolver()),
                        new ClassNameWithoutSuffixInflector('Request')
                    )
                ]
            )
        );
    }
399949
public function getCached()
    {
        $cache = $this->cache->get('config');
        if ($cache === false) {
            $cache = $this->notCached;
            $this->cache->set('config', $cache);
        }
        return $cache;
    }
951496
public function getCache()
    {
        if (null === $this->cache) {
            if (isset($this->options['cache']) && is_string($this->options['cache'])) {
                $this->cache = $this->container->get($this->options['cache']);
            }
        }
        
        return $this->cache;
    }
802898
public function getGuzzle()
    {

        if ($this->guzzle)
            return $this->guzzle;

        $this->guzzle = new Client();

        return $this->guzzle;

    }
1342656
public static function getInstance(){
		if(!is_object(self::$instance)){
			if(DEBUG_CACHE){
				BLog::addToLog('[BCache]: Creating cache object ('.CACHE_TYPE.')...');
				}
			switch(CACHE_TYPE){
				case 'files':
					self::$instance=new \Brilliant\Cache\BCacheFiles();
					break;
				case 'memcache':
					bimport('cache.memcache');
					self::$instance=new \Brilliant\Cache\BCacheMemcache();
					break;
				case 'memcached':
					bimport('cache.memcached');
					self::$instance=new \Brilliant\Cache\BCacheMemcached();
					break;
				default:
					self::$instance=NULL;
					break;
				}
			}
		return self::$instance;
		}
1073821
public function getCache()
    {
        if (null === self::$cache) {
            if (!empty($this->appConfig['cache']['driver'])) {
                // Options definition.
                if (empty($this->appConfig['cache']['options'])) {
                    $options = array();
                } else {
                    $options = $this->appConfig['cache']['options'];
                }

                // Driver definition.
                if ('memcached' !== $this->appConfig['cache']['driver']) {
                    $className = $this->appConfig['cache']['driver'];
                } else {
                    $className = '\Towel\Cache\TowelMemcached';
                }

                // Driver instantiation
                $cacheDriver = new $className();
                $cacheDriver->setOptions($options);
            }

            self::$cache = new TowelCache($cacheDriver);
        }

        return self::$cache;
    }
866239
public function getSessionClient()
    {
        if (is_null($this->sessionClient)) {
            $this->sessionClient = Client::makeGuzzle($this->sessionEndpoint);
        }

        return $this->sessionClient;
    }
1059546
private static function cache()
    {
        if (is_null(self::$memcached) && class_exists('Memcached')) {
            $servers = [['host' => '127.0.0.1', 'port' => 11211, 'weight' => 100]];

            self::$memcached = new Memcached();

            foreach ($servers as $server) {
                self::$memcached->addServer(
                    $server['host'], $server['port'], $server['weight']
                );
            }

            if (self::$memcached->getVersion() === false) {
                throw new \RuntimeException("Could not establish Memcached connection.");
            }
        }

        return self::$memcached;
    }
325606
public function getTopology() {
		$descriptor = new Descriptor('Memcache', self::TOPOLOGY_BACKEND);
		$descriptor->id = $this->getTopologyId();
		
		if ($this->memcacheClient === null) {
			return $descriptor;
		}
		
		$info = $this->memcacheClient->getextendedstats();
		
		if (count($info) === 1) {
			$serverInfo = current($info);
			
			$descriptor->host = key($info);
			
			$used  = $serverInfo['bytes'];
			$limit = $serverInfo['limit_maxbytes'];
		} else {
			$used   = 0;
			$limit  = 0;
			$hostNm = 0;
			
			foreach ($info as $serverKey => $serverInfo) {
				$used  += $serverInfo['bytes'];
				$limit += $serverInfo['limit_maxbytes'];

				$descriptor->setProperty('host.' . $hostNm ++, $serverKey);
			}
		}
		
		$memoryFormatter = new Memory();
		
		$descriptor->version = $serverInfo['version'];
		$descriptor->used    = $memoryFormatter->format($used);
		$descriptor->limit   = $memoryFormatter->format($limit);
		$descriptor->filled  = round($used / $limit * 100, 2) . '%';
		
		return $descriptor;
	}
852577
private function getClient() {
        $login = $this->getParam('login');
        $passwordHash = $this->getParam('passwd_hash');
        $token = $this->getParam('token');

        if (empty($token) && (empty($login) || empty($passwordHash))) {
            throw new ConfigurationException(__CLASS__ . ' is not configured properly. Please set "token" or "login" and "passwd_pash" parameters properly.');
        }

        $client = null;
        if (!empty($token)) {
            $client = Client::createFromToken($token);
        }
        else {
            $client = new Client($login);
            $client->setPasswordHash($passwordHash);
        }
        return $client;
    }