public function client(array $config = array(), $lifetime = null)
    {    
        if(is_null($lifetime))
        {
            $lifetime = $this->lifetime;
        }

        $client = new Client($config);

        $emitter = $client->getEmitter();

        $subscriber = new CacheSubscriber($this->cache, $lifetime, $this->cachePrefix);

        $emitter->attach($subscriber);
        
        return $client;
    }
public function client(array $config = array(), $lifetime = null)
    {    
        if(is_null($lifetime))
        {
            $lifetime = $this->lifetime;
        }

        $client = new Client($config);

        $emitter = $client->getEmitter();

        $subscriber = new CacheSubscriber($this->cache, $lifetime, $this->cachePrefix);

        $emitter->attach($subscriber);
        
        return $client;
    }
public function client ( array $ config = array ( ) , $ lifetime = null ) { if ( is_null ( $ lifetime ) ) { $ lifetime = $ this -> lifetime ; } $ client = new Client ( $ config ) ; $ emitter = $ client -> getEmitter ( ) ; $ subscriber = new CacheSubscriber ( $ this -> cache , $ lifetime , $ this -> cachePrefix ) ; $ emitter -> attach ( $ subscriber ) ; return $ client ; }
Get the cached guzzle client

@param  array $config    guzzle's client config array
@param  int   $lifetime  (optional) lifetime in cache for this request.

@return \GuzzleHttp\Guzzle\Client;
Get the cached guzzle client