Skip to content

Commit

Permalink
fix: path-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Thijzer committed Sep 21, 2023
1 parent 190f809 commit 2a356a4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Component/Action/GetImageFromBynderAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ class GetImageFromBynderAction implements OptionsInterface
public function init(): void
{
if (null === $this->cachePool) {
$cachePath = $_ENV['CACHE_PATH'] ?? sys_get_temp_dir();

$this->cachePool = new LocalFilesystemCache(
sys_get_temp_dir() .
$cachePath .
DIRECTORY_SEPARATOR .
'bynder_cache' .
DIRECTORY_SEPARATOR .
Expand All @@ -43,7 +45,7 @@ public function apply(array $item): array
$cacheKey = md5(json_encode($item)); // You can modify this based on your data structure

return $this->cachePool->retrieve($cacheKey, function (CacheSettings $settings) use ($item) {
$settings->setTtl(259200); # 3 day
$settings->setTtl(3600 * 24 * 7); # 1 week
$fields = $this->options['fields'];
$bynder_url = $this->options['bynder_url'];
$bynder_token = $this->options['bynder_token'];
Expand Down

0 comments on commit 2a356a4

Please sign in to comment.