Skip to content
Permalink
Browse files

Add unix socket support to Redis cache engine

Refs #3438
  • Loading branch information...
DIDoS authored and markstory committed May 5, 2014
1 parent 63ab865 commit cd445f2526554769a3024bb6ac047f3dfff4d1bd
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/Cake/Cache/Engine/RedisEngine.php
@@ -38,6 +38,7 @@ class RedisEngine extends CacheEngine {
* - port = integer port number to the Redis server (default: 6379)
* - timeout = float timeout in seconds (default: 0)
* - persistent = boolean Connects to the Redis server with a persistent connection (default: true)
* - unix_socket = path to the unix socket file (default: false)
*
* @var array
*/
@@ -64,7 +65,8 @@ public function init($settings = array()) {
'port' => 6379,
'password' => false,
'timeout' => 0,
'persistent' => true
'persistent' => true,
'unix_socket' => false
), $settings)
);
@@ -80,7 +82,9 @@ protected function _connect() {
$return = false;
try {
$this->_Redis = new Redis();
if (empty($this->settings['persistent'])) {
if (!empty($this->settings['unix_socket'])) {
$return = $this->_Redis->connect($this->settings['unix_socket']);
} elseif (empty($this->settings['persistent'])) {
$return = $this->_Redis->connect($this->settings['server'], $this->settings['port'], $this->settings['timeout']);
} else {
$persistentId = $this->settings['port'] . $this->settings['timeout'] . $this->settings['database'];

0 comments on commit cd445f2

Please sign in to comment.
You can’t perform that action at this time.