Cache config adapter connection status to reduce number of calls to DBA::isConnected()

2022.09-rc
Hypolite Petovan 2019-02-08 20:12:07 -05:00
rodzic 3aa77685fc
commit 337c02bd80
3 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -6,8 +6,11 @@ use Friendica\Database\DBA;
abstract class AbstractDbaConfigAdapter abstract class AbstractDbaConfigAdapter
{ {
/** @var bool */
protected $connected = true;
public function isConnected() public function isConnected()
{ {
return DBA::connected(); return $this->connected;
} }
} }

Wyświetl plik

@ -26,6 +26,7 @@ class JITConfigAdapter extends AbstractDbaConfigAdapter implements IConfigAdapte
public function __construct(IConfigCache $configCache) public function __construct(IConfigCache $configCache)
{ {
$this->configCache = $configCache; $this->configCache = $configCache;
$this->connected = DBA::connected();
} }
/** /**

Wyświetl plik

@ -27,6 +27,7 @@ class PreloadConfigAdapter extends AbstractDbaConfigAdapter implements IConfigAd
public function __construct(IConfigCache $configCache) public function __construct(IConfigCache $configCache)
{ {
$this->configCache = $configCache; $this->configCache = $configCache;
$this->connected = DBA::connected();
$this->load(); $this->load();
} }