refactor: dont create multiple instances of the cache (#3504)

This commit is contained in:
Dag 2023-07-08 17:03:12 +02:00 committed by GitHub
parent b594ad2de3
commit c1c8304fc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 34 additions and 42 deletions

View file

@ -415,9 +415,7 @@ abstract class BridgeAbstract implements BridgeInterface
*/
protected function loadCacheValue(string $key, $duration = null)
{
$cacheFactory = new CacheFactory();
$cache = $cacheFactory->create();
$cache = RssBridge::getCache();
// Create class name without the namespace part
$scope = $this->getShortName();
$cache->setScope($scope);
@ -441,9 +439,7 @@ abstract class BridgeAbstract implements BridgeInterface
*/
protected function saveCacheValue(string $key, $value)
{
$cacheFactory = new CacheFactory();
$cache = $cacheFactory->create();
$cache = RssBridge::getCache();
$scope = $this->getShortName();
$cache->setScope($scope);
$cache->setKey([$key]);