Skip to content

Commit 683568a

Browse files
committed
Remove caching.
1 parent 155f1cb commit 683568a

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

src/GitHub/GetLatestRelease.php

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,30 @@
22

33
namespace App\GitHub;
44

5-
//
6-
7-
use DateTimeImmutable;
8-
use Tempest\Cache\Cache;
95
use Tempest\Core\Kernel;
106
use Tempest\HttpClient\HttpClient;
117
use Throwable;
128

139
final class GetLatestRelease
1410
{
15-
public function __construct(
16-
private HttpClient $httpClient,
17-
private Cache $cache,
18-
) {
19-
}
11+
public function __construct(private HttpClient $httpClient)
12+
{}
2013

2114
public function __invoke(): ?string
2215
{
23-
return $this->cache->resolve(
24-
key: 'tempest-latest-release',
25-
cache: function () {
26-
// Default release to the currently running version of Tempest.
27-
$defaultRelease = sprintf('v%s', Kernel::VERSION);
16+
// Default release to the currently running version of Tempest.
17+
$defaultRelease = sprintf('v%s', Kernel::VERSION);
2818

29-
try {
30-
$body = $this->httpClient->get('https://api.github.com/repos/tempestphp/tempest-framework/releases/latest')->body;
19+
try {
20+
$body = $this
21+
->httpClient
22+
->get('https://api.github.com/repos/tempestphp/tempest-framework/releases/latest')
23+
->body;
3124

32-
return json_decode($body)->tag_name ?? $defaultRelease;
33-
} catch (Throwable $e) {
34-
ll($e);
35-
return Kernel::VERSION;
36-
}
37-
},
38-
expiresAt: new DateTimeImmutable('+12 hours'),
39-
);
25+
return json_decode($body)->tag_name ?? $defaultRelease;
26+
} catch (Throwable $e) {
27+
ll($e);
28+
return Kernel::VERSION;
29+
}
4030
}
4131
}

0 commit comments

Comments
 (0)