Skip to content

Commit be702fd

Browse files
authored
Merge pull request #29 from jsor-labs/github-client-cache
Cache responses of the github client to speed up builds
2 parents c895e7e + e5af5e1 commit be702fd

File tree

4 files changed

+190
-2
lines changed

4 files changed

+190
-2
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ branches:
1212
cache:
1313
directories:
1414
- $HOME/.composer/cache/files
15+
- tmp/cache
1516
- tmp/components
1617

1718
before_script:

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"require-dev": {
2121
"jsor/berti": "^4.0",
22+
"symfony/cache": "^3.2",
2223
"symfony/filesystem": "^3.2",
2324
"symfony/process": "^3.2",
2425
"vlucas/phpdotenv": "^2.4",

composer.lock

Lines changed: 176 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/berti.config.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@
3333
'index.html' => 'homepage.html.twig'
3434
];
3535

36+
$container['github.client'] = $container->extend('github.client', function (Github\Client $client) {
37+
$client->addCache(
38+
new Symfony\Component\Cache\Adapter\FilesystemAdapter(
39+
'github.client',
40+
0,
41+
__DIR__ . '/../tmp/cache'
42+
)
43+
);
44+
45+
return $client;
46+
});
47+
3648
$container['github.url_generator'] = $container->extend('github.url_generator', function (callable $urlGenerator) {
3749
return function (string $repository, string $url, string $cwd = null) use ($urlGenerator) {
3850
return React\Website\Berti\github_url_generator(

0 commit comments

Comments
 (0)