diff options
author | 2023-09-21 22:05:55 +0200 | |
---|---|---|
committer | 2023-09-21 22:05:55 +0200 | |
commit | 7329b83cc0fe1a5f707f864b1f3d62efd4be2172 (patch) | |
tree | 6e0a241fb8bac65b6f06327453f48ed75d2cdbf7 /lib/BridgeAbstract.php | |
parent | 360f953be82b7340bd153991bdc87f699db598a4 (diff) | |
download | rss-bridge-7329b83cc0fe1a5f707f864b1f3d62efd4be2172.tar.gz rss-bridge-7329b83cc0fe1a5f707f864b1f3d62efd4be2172.tar.zst rss-bridge-7329b83cc0fe1a5f707f864b1f3d62efd4be2172.zip |
refactor: logger (#3678)
Diffstat (limited to 'lib/BridgeAbstract.php')
-rw-r--r-- | lib/BridgeAbstract.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/BridgeAbstract.php b/lib/BridgeAbstract.php index f51fe893..a3d84188 100644 --- a/lib/BridgeAbstract.php +++ b/lib/BridgeAbstract.php @@ -27,8 +27,15 @@ abstract class BridgeAbstract protected string $queriedContext = ''; private array $configuration = []; - public function __construct() - { + protected CacheInterface $cache; + protected Logger $logger; + + public function __construct( + CacheInterface $cache, + Logger $logger + ) { + $this->cache = $cache; + $this->logger = $logger; } abstract public function collectData(); @@ -310,16 +317,14 @@ abstract class BridgeAbstract protected function loadCacheValue(string $key) { - $cache = RssBridge::getCache(); $cacheKey = $this->getShortName() . '_' . $key; - return $cache->get($cacheKey); + return $this->cache->get($cacheKey); } protected function saveCacheValue(string $key, $value, $ttl = 86400) { - $cache = RssBridge::getCache(); $cacheKey = $this->getShortName() . '_' . $key; - $cache->set($cacheKey, $value, $ttl); + $this->cache->set($cacheKey, $value, $ttl); } public function getShortName(): string |