From 78520f7d1c8c7db4b9c5ef2e8ad140dfd8f9646f Mon Sep 17 00:00:00 2001 From: Kaz Watanabe Date: Fri, 16 Jun 2017 11:28:19 +0900 Subject: [PATCH] add auth --- src/PredisEngine.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PredisEngine.php b/src/PredisEngine.php index c7898ef..4cf50ea 100644 --- a/src/PredisEngine.php +++ b/src/PredisEngine.php @@ -33,6 +33,7 @@ final class PredisEngine extends CacheEngine 'prefix' => 'cake_', 'probability' => 100, 'connections' => 'tcp://127.0.0.1:6379', + 'password' => null, 'options' => null, ]; @@ -52,6 +53,10 @@ public function init(array $config = []) $this->client = new Client($this->_config['connections'], $this->_config['options']); $this->client->connect(); + if (!is_null($this->_config['password'])) { + $this->client->auth($this->_config['password']); + } + return $this->client->isConnected(); }