1
0
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:
Dag
2023-07-08 17:03:12 +02:00
committed by GitHub
parent b594ad2de3
commit c1c8304fc0
10 changed files with 34 additions and 42 deletions

View File

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