Skip to content

Fixed the cache plugin #408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/Github/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
use Http\Client\HttpClient;
use Http\Discovery\HttpClientDiscovery;
use Http\Discovery\MessageFactoryDiscovery;
use Http\Discovery\StreamFactoryDiscovery;
use Http\Discovery\UriFactoryDiscovery;
use Http\Message\MessageFactory;
use Http\Message\SteamFactory;
use Psr\Cache\CacheItemPoolInterface;

/**
Expand Down Expand Up @@ -110,6 +112,11 @@ class Client
*/
private $messageFactory;

/**
* @var StreamFactory
*/
private $streamFactory;

/**
* @var Plugin[]
*/
Expand Down Expand Up @@ -141,6 +148,7 @@ public function __construct(HttpClient $httpClient = null)
{
$this->httpClient = $httpClient ?: HttpClientDiscovery::find();
$this->messageFactory = MessageFactoryDiscovery::find();
$this->streamFactory = StreamFactoryDiscovery::find();

$this->responseHistory = new History();
$this->addPlugin(new GithubExceptionThrower());
Expand Down Expand Up @@ -382,7 +390,7 @@ public function addHeaders(array $headers)
public function addCache(CacheItemPoolInterface $cachePool)
{
$this->removeCache();
$this->addPlugin(new Plugin\CachePlugin($cachePool));
$this->addPlugin(new Plugin\CachePlugin($cachePool, $this->streamFactory));
}

/**
Expand Down