Skip to content

Commit c1217f7

Browse files
committed
Removes stargazers cache.
1 parent a0c37bf commit c1217f7

File tree

4 files changed

+15
-21
lines changed

4 files changed

+15
-21
lines changed

src/GitHub/GetStargazersCount.php

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,28 @@
22

33
namespace App\GitHub;
44

5-
use DateTimeImmutable;
6-
use Tempest\Cache\Cache;
75
use Tempest\HttpClient\HttpClient;
86
use Throwable;
97

108
final class GetStargazersCount
119
{
1210
public function __construct(
1311
private HttpClient $httpClient,
14-
private Cache $cache,
1512
) {
1613
}
1714

1815
public function __invoke(): ?string
1916
{
20-
return $this->cache->resolve(
21-
key: 'tempest-stargazers',
22-
cache: function () {
23-
try {
24-
$body = $this->httpClient->get('https://api.github.com/repos/tempestphp/tempest-framework')->body;
25-
$stargazers = json_decode($body)->stargazers_count ?? null;
17+
try {
18+
$body = $this->httpClient->get('https://api.github.com/repos/tempestphp/tempest-framework')->body;
19+
$stargazers = json_decode($body)->stargazers_count ?? null;
2620

27-
return $stargazers > 999
28-
? (round($stargazers / 1000, 1) . 'K')
29-
: $stargazers;
30-
} catch (Throwable $e) {
31-
ll($e);
32-
return null;
33-
}
34-
},
35-
expiresAt: new DateTimeImmutable('+12 hours'),
36-
);
21+
return $stargazers > 999
22+
? (round($stargazers / 1000, 1) . 'K')
23+
: $stargazers;
24+
} catch (Throwable $e) {
25+
ll($e);
26+
return null;
27+
}
3728
}
3829
}

src/Migrations/FixDateTimeFieldsMigration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ public function __invoke()
2424

2525
$this->success('Done');
2626
}
27-
}
27+
}

src/Web/Documentation/ChapterView.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Tempest\Support\Arr\ImmutableArray;
88
use Tempest\View\IsView;
99
use Tempest\View\View;
10+
1011
use function Tempest\Support\Arr\map_iterable;
1112
use function Tempest\Support\str;
1213

src/Web/x-header.view.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ class="transition hover:text-(--ui-text-highlighted) <?= is_current_uri([Chapter
4040
</a>
4141
<a
4242
:href="uri([BlogController::class, 'index'])"
43-
class="transition hover:text-(--ui-text-highlighted) <?= is_current_uri([BlogController::class, 'show']) || is_current_uri([BlogController::class, 'index']) ? 'md:text-(--ui-primary)' : '' ?>"
43+
class="transition hover:text-(--ui-text-highlighted) <?= is_current_uri([BlogController::class, 'show']) || is_current_uri([BlogController::class, 'index'])
44+
? 'md:text-(--ui-primary)'
45+
: '' ?>"
4446
>Blog</a>
4547
<a href="https://github.com/tempestphp/tempest-framework" class="transition hover:text-(--ui-text-highlighted) flex items-center gap-x-1.5 ml-4">
4648
<x-icon name="tabler:brand-github" class="size-6" />

0 commit comments

Comments
 (0)