Skip to content

Commit 7a7f55a

Browse files
committed
Update README.markdown
Fix example how to use `CachedHttpClient`. Fix #27
1 parent dcabad5 commit 7a7f55a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.markdown

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,16 @@ From `$client` object, you can access to all GitHub.
6666
// This file is generated by Composer
6767
require_once 'vendor/autoload.php';
6868

69-
$client = new Github\Client(new CachedHttpClient(new FilesystemCache('/tmp/github-api-cache')));
69+
$client = new Github\Client(
70+
new Github\HttpClient\CachedHttpClient(array('cache_dir' => '/tmp/github-api-cache')
71+
);
72+
73+
// Or select directly which cache you want to use
74+
$client = new Github\Client(
75+
new Github\HttpClient\CachedHttpClient(
76+
new Github\HttpClient\Cache\FilesystemCache('/tmp/github-api-cache')
77+
)
78+
);
7079
```
7180

7281
Using cache, the client will get cached responses if resources haven't changed since last time,

0 commit comments

Comments
 (0)