File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,12 @@ $client->connect('127.0.0.1', 6379);
7777$pool = new RedisCachePool($client);
7878
7979$client = new \Github\Client();
80- $client->useCache($pool);
80+ $client->addCache($pool);
81+
82+ // Do some request
83+
84+ // Stop using cache
85+ $client->removeCache();
8186```
8287
8388Using cache, the client will get cached responses if resources haven't changed since last time,
Original file line number Diff line number Diff line change @@ -374,14 +374,23 @@ public function addHeaders(array $headers)
374374 }
375375
376376 /**
377+ * Add a cache plugin to cache responses locally.
377378 * @param CacheItemPoolInterface $cache
378379 */
379- public function useCache (CacheItemPoolInterface $ cachePool )
380+ public function addCache (CacheItemPoolInterface $ cachePool )
380381 {
381382 $ this ->removePlugin (Plugin \CachePlugin::class);
382383 $ this ->addPlugin (new Plugin \CachePlugin ($ cachePool ));
383384 }
384385
386+ /**
387+ * Remove the cache plugin
388+ */
389+ public function removeCache ()
390+ {
391+ $ this ->removePlugin (Plugin \CachePlugin::class);
392+ }
393+
385394 /**
386395 * @param string $name
387396 *
You can’t perform that action at this time.
0 commit comments