mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-30 23:55:24 +02:00
refactor: logger (#3678)
This commit is contained in:
parent
360f953be8
commit
7329b83cc0
30 changed files with 297 additions and 338 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue