diff --git a/base.php b/base.php index da9e926..b66657c 100644 --- a/base.php +++ b/base.php @@ -495,3 +495,4 @@ function cronjob_db_create($software, $instance, $sql, $time=3600) { // classes require 'classes/PgDatabase.php'; +require 'classes/RedisDatabase.php'; diff --git a/classes/RedisDatabase.php b/classes/RedisDatabase.php new file mode 100644 index 0000000..7aa63d8 --- /dev/null +++ b/classes/RedisDatabase.php @@ -0,0 +1,19 @@ +connect($config['redis_host'], $config['redis_port']); + if (isset($config['redis_password'])) + $this->auth($config['redis_password']); + } catch (RedisException $e) { + return apiresult(['error' => 'Could not connect to Redis: '.strval($e)]); + } + + if ($this->ping()) + return true; + return false; + } +}