class Config
{
/**
- * @var Config\IConfigAdapter
+ * @var Config\IConfigAdapter|null
*/
private static $adapter;
*/
public static function load($family = "config")
{
- if (!isset(self::$adapter)) {
+ if (!isset(self::$adapter) || !self::$adapter->isConnected()) {
return;
}
*/
public static function get($family, $key, $default_value = null, $refresh = false)
{
- if (!isset(self::$adapter)) {
+ if (!isset(self::$adapter) || !self::$adapter->isConnected()) {
return self::$cache->get($family, $key, $default_value);
}
*/
public static function set($family, $key, $value)
{
- if (!isset(self::$adapter)) {
- self::$cache->set($family, $key, $value);
- return true;
+ if (!isset(self::$adapter) || !self::$adapter->isConnected()) {
+ return self::$cache->set($family, $key, $value);
}
return self::$adapter->set($family, $key, $value);
*/
public static function delete($family, $key)
{
- if (!isset(self::$adapter)) {
+ if (!isset(self::$adapter) || !self::$adapter->isConnected()) {
self::$cache->delete($family, $key);
}