-
-
Notifications
You must be signed in to change notification settings - Fork 599
Closed
Description
Hi,
I scratch my head with this issue. My cache seems to work correctly but I don't understand why for this case it is not...
For instance:
1- I fetch all files within the given path.
2- For each file I fetch its commit(s).
public function testRateLimit()
{
$contents = $this->client->api('repo')->contents()->show('KnpLabs', 'php-github-api', 'lib/Github/HttpClient/Cache');
foreach ($contents as $content) {
$commits = $this->client->api('repo')->commits()->all('KnpLabs', 'php-github-api', array('sha' => 'master', 'path' => $content['path']));
}
}
Then wherever you want run the following test:
for ($i = 0; $i < 31; $i++) {
var_dump("Test $i");
var_dump($this->testRateLimit());
if ($i == 10 || $i == 20 || $i == 30) {
$response = $this->client->getHttpClient()->get("rate_limit");
var_dump(ResponseMediator::getContent($response)['rate']['remaining'] . ' remaining calls');
}
}
As you can see the Github Api rate remaining decrease...
This is how I instantiated the client:
$cachedClient = new CachedHttpClient;
$cachedClient->setCache(new FilesystemCache('/tmp/github-api-cache'));
$client = new Client($cachedClient);
$client->authenticate('my-token', null, Client::AUTH_HTTP_TOKEN);
return $client;
Why the cache is not used?
Thank you very much for your great work and your help.
Metadata
Metadata
Assignees
Labels
No labels