From 2417203f069cc876783267c9d113106db0815077 Mon Sep 17 00:00:00 2001 From: kGablo Date: Thu, 20 Jun 2024 13:24:10 +0200 Subject: [PATCH] cache key fix --- Model/ApiFacade/Transaction/TransactionApiFacade.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Model/ApiFacade/Transaction/TransactionApiFacade.php b/Model/ApiFacade/Transaction/TransactionApiFacade.php index da6e6b2..9fbd0da 100755 --- a/Model/ApiFacade/Transaction/TransactionApiFacade.php +++ b/Model/ApiFacade/Transaction/TransactionApiFacade.php @@ -11,7 +11,6 @@ class TransactionApiFacade { - private const CHANNELS_CACHE_KEY = 'tpay_channels'; private const CACHE_LIFETIME = 86400; /** @var TransactionOriginApi */ @@ -75,7 +74,9 @@ public function channels(): array return []; } - $channels = $this->cache->load(self::CHANNELS_CACHE_KEY); + $cacheKey = 'tpay_channels'.md5(join('|', [$this->tpay->getOpenApiClientId(), $this->tpay->getOpenApiPassword(), !$this->tpay->useSandboxMode()])); + + $channels = $this->cache->load($cacheKey); if ($channels) { return unserialize($channels); @@ -85,7 +86,7 @@ public function channels(): array return true === $channel->available; }); - $this->cache->save(serialize($channels), self::CHANNELS_CACHE_KEY, [], self::CACHE_LIFETIME); + $this->cache->save(serialize($channels), $cacheKey, [], self::CACHE_LIFETIME); return $channels; }