Skip to content

Commit

Permalink
Merge pull request #695 from spatie/cache-config-fallbacks
Browse files Browse the repository at this point in the history
Provide fallbacks for config values
  • Loading branch information
rubenvanassche authored Mar 12, 2024
2 parents 1390766 + 1887ef7 commit 2a76839
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Support/Caching/DataStructureCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class DataStructureCache
public function __construct(
protected array $cacheConfig,
) {
$this->store = cache()->store($this->cacheConfig['store'])?->getStore();
$this->prefix = $this->cacheConfig['prefix'] ? "{$this->cacheConfig['prefix']}." : '';
$this->duration = $this->cacheConfig['duration'];
$this->store = cache()->store(($this->cacheConfig['store'] ?? null))?->getStore();
$this->prefix = ($this->cacheConfig['prefix'] ?? '') ? "{$this->cacheConfig['prefix']}." : '';
$this->duration = $this->cacheConfig['duration'] ?? null;
}

public function getConfig(): ?CachedDataConfig
Expand Down

0 comments on commit 2a76839

Please sign in to comment.