Skip to content

Commit 5216537

Browse files
committed
Use a protected property instead of a class constant
1 parent ef6290b commit 5216537

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Middlewares/CacheResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class CacheResponse extends BaseCacheMiddleware
2121
{
22-
private const PENDING_CACHE_ATTRIBUTE = '_response_cache.pending';
22+
protected string $pendingCacheAttribute = '_response_cache.pending';
2323

2424
public function __construct(
2525
protected ResponseCache $responseCache,
@@ -71,7 +71,7 @@ public function handle(Request $request, Closure $next, ...$args): Response
7171
$response = $next($request);
7272

7373
if ($this->responseCache->shouldCache($request, $response)) {
74-
$request->attributes->set(self::PENDING_CACHE_ATTRIBUTE, [
74+
$request->attributes->set($this->pendingCacheAttribute, [
7575
'lifetime' => $lifetimeInSeconds,
7676
'tags' => $tags,
7777
]);
@@ -87,7 +87,7 @@ public function handle(Request $request, Closure $next, ...$args): Response
8787

8888
public function terminate(Request $request, Response $response): void
8989
{
90-
$pending = $request->attributes->get(self::PENDING_CACHE_ATTRIBUTE);
90+
$pending = $request->attributes->get($this->pendingCacheAttribute);
9191

9292
if (! $pending) {
9393
return;

0 commit comments

Comments
 (0)