Skip to content

Commit 678b695

Browse files
authored
fix(cache): support enum tags (#1756)
1 parent 304a635 commit 678b695

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/cache/src/CacheInitializer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ public function initialize(ClassReflector $class, null|string|UnitEnum $tag, Con
3535
);
3636
}
3737

38-
private function shouldCacheBeEnabled(?string $tag): bool
38+
private function shouldCacheBeEnabled(null|string|UnitEnum $tag): bool
3939
{
4040
$globalCacheEnabled = (bool) env('CACHE_ENABLED', default: true);
4141

4242
if (! $tag) {
4343
return $globalCacheEnabled;
4444
}
4545

46+
if ($tag instanceof UnitEnum) {
47+
$tag = $tag->name;
48+
}
49+
4650
$environmentVariableName = str($tag)
4751
->snake()
4852
->upper()

0 commit comments

Comments
 (0)