Skip to content

Commit

Permalink
Cleaner single element array push
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaucau committed Dec 3, 2021
1 parent 0b7b92b commit 6350998
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Middleware/LSCacheMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
//Guest only cache for now
$user = RequestUtil::getActor($request);
if ($user->isGuest()) {
array_push($lscacheParams, 'public');
$lscacheParams[] = 'public';

$publicTTL = $this->settings->get('acpl-lscache.public_cache_ttl') ?: 300;
array_push($lscacheParams, "max-age=$publicTTL");
$lscacheParams[] = "max-age=$publicTTL";
} else {
array_push($lscacheParams, 'no-cache');
$lscacheParams[] = 'no-cache';
}

//TODO user group cache vary https://docs.litespeedtech.com/lscache/devguide/#cache-vary
Expand Down
4 changes: 2 additions & 2 deletions src/Middleware/LSCachePurgeMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface

// discussions.index is handled earlier
if (!$isDiscussion) {
array_push($purgeParams, "tag=$rootRouteName.index");
$purgeParams[] = "tag=$rootRouteName.index";
}

if (!empty($params) && !empty($params['id'])) {
array_push($purgeParams, "tag=$rootRouteName{$params['id']}");
$purgeParams[] = "tag=$rootRouteName{$params['id']}";
}
}

Expand Down

0 comments on commit 6350998

Please sign in to comment.