mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-05 16:17:28 +02:00
refactor: dont create multiple instances of the cache (#3504)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
final class RssBridge
|
||||
{
|
||||
private static CacheInterface $cache;
|
||||
|
||||
public function main(array $argv = [])
|
||||
{
|
||||
if ($argv) {
|
||||
@@ -69,6 +71,10 @@ final class RssBridge
|
||||
// Consider: ini_set('error_reporting', E_ALL & ~E_DEPRECATED);
|
||||
date_default_timezone_set(Configuration::getConfig('system', 'timezone'));
|
||||
|
||||
// Create cache
|
||||
$cacheFactory = new CacheFactory();
|
||||
self::setCache($cacheFactory->create());
|
||||
|
||||
if (Configuration::getConfig('authentication', 'enable')) {
|
||||
$authenticationMiddleware = new AuthenticationMiddleware();
|
||||
$authenticationMiddleware();
|
||||
@@ -98,4 +104,14 @@ final class RssBridge
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
|
||||
public static function getCache(): CacheInterface
|
||||
{
|
||||
return self::$cache;
|
||||
}
|
||||
|
||||
public static function setCache(CacheInterface $cache): void
|
||||
{
|
||||
self::$cache = $cache;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user