From 010a06ca879c5bbb4a42024b803a19fbdf59df6c Mon Sep 17 00:00:00 2001 From: John Czaplicki Date: Thu, 3 Dec 2020 17:16:59 -0600 Subject: [PATCH] Ensure correct cache settings is used when writeWithParent is used with Fallback engine --- src/CacheEnginesHelper.php | 7 ++++++- src/FallbackEngine.php | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/CacheEnginesHelper.php b/src/CacheEnginesHelper.php index d6b9c0c..7093e6a 100644 --- a/src/CacheEnginesHelper.php +++ b/src/CacheEnginesHelper.php @@ -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; diff --git a/src/FallbackEngine.php b/src/FallbackEngine.php index 546eff3..d3cf553 100644 --- a/src/FallbackEngine.php +++ b/src/FallbackEngine.php @@ -150,4 +150,9 @@ public function key($key) { return Cache::engine($this->activeCache)->key($key); } + + public function getActiveCacheSettings() + { + return Cache::engine($this->activeCache)->settings(); + } }