aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Micieli <micieli@laposte.net>2019-10-05 17:11:59 +0200
committerWilly Micieli <micieli@laposte.net>2019-10-05 17:11:59 +0200
commit57502e9923678350fb29c5c02695f2c9384e9276 (patch)
tree29f014e27e27e72fee77e301ec08ad15cf17606e
parent1712f33a3f7b63fe476e66feca79b2c63cb17812 (diff)
downloadimperium-57502e9923678350fb29c5c02695f2c9384e9276.zip
imperium-57502e9923678350fb29c5c02695f2c9384e9276.tar.gz
add redis instnace in all controllers
-rw-r--r--composer.json3
-rw-r--r--config/redis.yaml6
-rw-r--r--imperium/App.php13
-rw-r--r--imperium/Management.php11
-rw-r--r--imperium/Redis/Redis.php10
5 files changed, 41 insertions, 2 deletions
diff --git a/composer.json b/composer.json
index 5eeebd9..63d9390 100644
--- a/composer.json
+++ b/composer.json
@@ -47,7 +47,8 @@
"php-di/php-di": "^6.0",
"doctrine/annotations": "^1.6",
"danielstjules/stringy": "^3.1",
- "fzaninotto/faker": "^1.7"
+ "fzaninotto/faker": "^1.7",
+ "ext-redis": "*"
},
"autoload-dev": {
"psr-4": {
diff --git a/config/redis.yaml b/config/redis.yaml
new file mode 100644
index 0000000..4db1295
--- /dev/null
+++ b/config/redis.yaml
@@ -0,0 +1,6 @@
+host: '127.0.0.1'
+port: 6379
+timeout: 0.0
+reserved: null
+retryInterval: 0
+readTimeout: 0.0 \ No newline at end of file
diff --git a/imperium/App.php b/imperium/App.php
index 394c568..7db0a75 100644
--- a/imperium/App.php
+++ b/imperium/App.php
@@ -17,6 +17,7 @@ namespace Imperium {
use Imperium\Encrypt\Crypt;
use Imperium\Exception\Kedavra;
use Imperium\File\Download;
+ use Imperium\Redis\Redis;
use Imperium\Session\Session;
use Imperium\Shopping\Shop;
use Imperium\Validator\Validator;
@@ -69,6 +70,7 @@ namespace Imperium {
*/
private $connect;
+
/**
* App constructor.
*
@@ -643,5 +645,16 @@ namespace Imperium {
{
return (new Crypt())->decrypt($encrypted, $unserialize);
}
+
+ /**
+ *
+ * Get an instance of redis
+ *
+ * @return Redis
+ */
+ public function redis(): Redis
+ {
+ return new Redis();
+ }
}
}
diff --git a/imperium/Management.php b/imperium/Management.php
index 7719b2c..97af650 100644
--- a/imperium/Management.php
+++ b/imperium/Management.php
@@ -14,7 +14,8 @@
use Imperium\Flash\Flash;
use Imperium\Html\Form\Form;
use Imperium\Query\Query;
- use Imperium\Routing\Router;
+ use Imperium\Redis\Redis;
+ use Imperium\Routing\Router;
use Imperium\Session\SessionInterface;
use Imperium\Shopping\Shop;
use Imperium\Tables\Table;
@@ -71,6 +72,14 @@
/**
*
+ * Get an instance of redis
+ *
+ * @return Redis
+ */
+ public function redis(): Redis;
+
+ /**
+ *
* Check if a table exist
*
* @param string $table
diff --git a/imperium/Redis/Redis.php b/imperium/Redis/Redis.php
new file mode 100644
index 0000000..def4e06
--- /dev/null
+++ b/imperium/Redis/Redis.php
@@ -0,0 +1,10 @@
+<?php
+
+namespace Imperium\Redis {
+
+
+ class Redis extends \Redis
+ {
+
+ }
+}