1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-06-22 02:45:27 +02:00

refactor: logger (#3678)

This commit is contained in:
Dag
2023-09-21 22:05:55 +02:00
committed by GitHub
parent 360f953be8
commit 7329b83cc0
30 changed files with 297 additions and 338 deletions

View File

@ -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