Skip to content

Commit

Permalink
Merge pull request #12 from Traackr/Patch-writeWithParent-FallbackEngine
Browse files Browse the repository at this point in the history
Bug fix: Wrong cache prefix used in writeWithParent with FallbackEngine
  • Loading branch information
jec3 authored Dec 3, 2020
2 parents 74534b3 + 010a06c commit 73bac35
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/CacheEnginesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ public static function writeWithParent(
$config = 'default',
$parentKey = ''
) {
$settings = Cache::settings($config);

if (method_exists(Cache::engine($config), 'getActiveCacheSettings')) {
$settings = Cache::engine($config)->getActiveCacheSettings();
} else {
$settings = Cache::settings($config);
}

if (empty($settings)) {
return false;
Expand Down
5 changes: 5 additions & 0 deletions src/FallbackEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,9 @@ public function key($key)
{
return Cache::engine($this->activeCache)->key($key);
}

public function getActiveCacheSettings()
{
return Cache::engine($this->activeCache)->settings();
}
}

0 comments on commit 73bac35

Please sign in to comment.