Skip to content

Commit

Permalink
Fix cache ttl (#1187)
Browse files Browse the repository at this point in the history
* fx cache ttl

* fx cache ttl
  • Loading branch information
luanfreitasdev authored Sep 28, 2023
1 parent 0d8b330 commit 46b4bd6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/PowerGridComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private function getCachedData(): mixed
$prefix = strval(data_get($this->setUp, 'cache.prefix'));
$customTag = strval(data_get($this->setUp, 'cache.tag'));
$forever = boolval(data_get($this->setUp, 'cache.forever', false));
$ttl = boolval(data_get($this->setUp, 'cache.ttl', false));
$ttl = intval(data_get($this->setUp, 'cache.ttl'));

$tag = $prefix . ($customTag ?: 'powergrid-' . $this->datasource()->getModel()->getTable() . '-' . $this->tableName);
$cacheKey = join('-', $this->getCacheKeys());
Expand All @@ -164,7 +164,6 @@ private function getCachedData(): mixed
return $this->readyToLoad ? Cache::tags($tag)->rememberForever($cacheKey, fn () => $this->fillData()) : collect([]);
}

/** @phpstan-ignore-next-line */
return $this->readyToLoad ? Cache::tags($tag)->remember($cacheKey, $ttl, fn () => $this->fillData()) : collect([]);
}

Expand Down

0 comments on commit 46b4bd6

Please sign in to comment.