Skip to content

Commit 1f176ee

Browse files
committed
Introduce using() method to conveniently define lifetime and tags
1 parent 4ebfb2e commit 1f176ee

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Middlewares/CacheResponse.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public function __construct(ResponseCache $responseCache)
2323
$this->responseCache = $responseCache;
2424
}
2525

26+
public static function using($lifetime, ...$tags): string
27+
{
28+
return static::class.':'.implode(',', [$lifetime, ...$tags]);
29+
}
30+
2631
public function handle(Request $request, Closure $next, ...$args): Response
2732
{
2833
$lifetimeInSeconds = $this->getLifetime($args);

0 commit comments

Comments
 (0)