Added option to connect through unix socket in redis cache driver
diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php
index 40823fc..8daed8b 100644
--- a/system/libraries/Cache/drivers/Cache_redis.php
+++ b/system/libraries/Cache/drivers/Cache_redis.php
@@ -44,6 +44,7 @@
* @var array
*/
protected static $_default_config = array(
+ 'socket_type' => 'tcp',
'host' => '127.0.0.1',
'password' => NULL,
'port' => 6379,
@@ -200,7 +201,13 @@
try
{
- $this->_redis->connect($config['host'], $config['port'], $config['timeout']);
+ if ($config['socket_type'] === 'unix')
+ {
+ $v = $this->_redis->connect($config['socket']);
+ } else // tcp socket
+ {
+ $this->_redis->connect($config['host'], $config['port'], $config['timeout']);
+ }
}
catch (RedisException $e)
{