Skip to content

Commit

Permalink
Use default craft cache duration
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelreichor committed Nov 8, 2024
1 parent e3ff2f4 commit baad9b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public function actionGetAllRoutes($siteId = null): Response
}
}

$duration = App::env('CRAFT_ENVIRONMENT') === 'dev' ? 0 : 3600;
$craftDuration = Craft::$app->getConfig()->getGeneral()->cacheDuration;
$duration = App::env('CRAFT_ENVIRONMENT') === 'dev' ? 0 : $craftDuration;
$hashedParamsKey = Utils::generateCacheKey($siteIds);
$cacheKey = 'queryapi_' . 'getAllRoutes' . '_' . $hashedParamsKey;

Expand Down
3 changes: 2 additions & 1 deletion src/services/ElementQueryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class ElementQueryService
*/
public function executeQuery(string $elementType, array $params): array
{
$duration = App::env('CRAFT_ENVIRONMENT') === 'dev' ? 0 : 3600;
$craftDuration = Craft::$app->getConfig()->getGeneral()->cacheDuration;
$duration = App::env('CRAFT_ENVIRONMENT') === 'dev' ? 0 : $craftDuration;
$hashedParamsKey = Utils::generateCacheKey($params);
$cacheKey = 'queryapi_' . $elementType . '_' . $hashedParamsKey;

Expand Down

0 comments on commit baad9b5

Please sign in to comment.