refactor: logger (#3678)

This commit is contained in:
Dag 2023-09-21 22:05:55 +02:00 committed by GitHub
parent 360f953be8
commit 7329b83cc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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