Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.idea
/vendor
.env
.phpunit.result.cache
composer.lock
composer.lock
2 changes: 1 addition & 1 deletion config/torchlight.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// leave this blank your default app cache will be used.
'cache' => env('TORCHLIGHT_CACHE_DRIVER'),

// Cache blocks for 30 days.
// Cache blocks for 30 days. Set null to store permanently
'cache_seconds' => env('TORCHLIGHT_CACHE_TTL', 60 * 60 * 24 * 30),

// Which theme you want to use. You can find all of the themes at
Expand Down
6 changes: 5 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ protected function setCacheFromBlocks(Collection $blocks, Collection $ids)

if (count($value)) {
$seconds = (int)Torchlight::config('cache_seconds', 7 * 24 * 60 * 60);
Torchlight::cache()->put($this->cacheKey($block), $value, $seconds);
if ($seconds) {
Torchlight::cache()->put($this->cacheKey($block), $value, $seconds);
} else {
Torchlight::cache()->forever($this->cacheKey($block), $value);
}
}
});
}
Expand Down