From 2d14673d1a513a372a5921775aa3987f8444477e Mon Sep 17 00:00:00 2001 From: Kakysha Date: Mon, 28 Oct 2013 20:20:24 +0400 Subject: Correct Redis connection troubleshooting --- system/libraries/Cache/drivers/Cache_redis.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'system/libraries/Cache') diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index 8daed8bc3..b0315a3ab 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -164,8 +164,7 @@ class CI_Cache_redis extends CI_Driver { if (extension_loaded('redis')) { - $this->_setup_redis(); - return TRUE; + return $this->_setup_redis(); } else { @@ -206,18 +205,26 @@ class CI_Cache_redis extends CI_Driver $v = $this->_redis->connect($config['socket']); } else // tcp socket { - $this->_redis->connect($config['host'], $config['port'], $config['timeout']); + $v = $this->_redis->connect($config['host'], $config['port'], $config['timeout']); + } + if (!$v) + { + log_message('debug','Redis connection refused. Check the config.'); + return FALSE; } } catch (RedisException $e) { - show_error('Redis connection refused. ' . $e->getMessage()); + log_message('debug','Redis connection refused. ' . $e->getMessage()); + return FALSE; } if (isset($config['password'])) { $this->_redis->auth($config['password']); } + + return TRUE; } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b