[icinga-checkins] icinga.org: icingaweb2-module-director/feature-ddo-playground: library/ Director/Redis: simple wrapper

git at icinga.org git at icinga.org
Tue Jul 19 10:31:51 CEST 2016


Module: icingaweb2-module-director
Branch: feature-ddo-playground
Commit: ef355d4b4492f0797435b586b1b5f816d5c50db8
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=ef355d4b4492f0797435b586b1b5f816d5c50db8

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Jun 21 11:41:30 2016 +0200

library/Director/Redis: simple wrapper

---

 .gitignore                 |    1 +
 library/Director/Redis.php |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/.gitignore b/.gitignore
index 8d98f9d..94a2c21 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 .*
+library/vendor/predis
diff --git a/library/Director/Redis.php b/library/Director/Redis.php
new file mode 100644
index 0000000..3db8f58
--- /dev/null
+++ b/library/Director/Redis.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace Icinga\Module\Director;
+
+use Predis\Client as PredisClient;
+
+class Redis
+{
+    protected static $redis;
+
+    public static function instance()
+    {
+        if (self::$redis === null) {
+            require_once dirname(__DIR__) . '/vendor/predis/autoload.php';
+            self::$redis = new PredisClient();
+        }
+
+        return self::$redis;
+    }
+}
diff --git a/library/vendor/predis/.keep b/library/vendor/predis/.keep
new file mode 100644
index 0000000..e69de29



More information about the icinga-checkins mailing list