From 7ed227b9075498e307c91a3ae0345755f935a520 Mon Sep 17 00:00:00 2001 From: logach Date: Tue, 27 Sep 2016 15:56:22 +0300 Subject: Add database index by default Select database if exists --- system/libraries/Cache/drivers/Cache_redis.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'system/libraries') diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index ec4432437..2d1ead452 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -58,7 +58,8 @@ class CI_Cache_redis extends CI_Driver 'host' => '127.0.0.1', 'password' => NULL, 'port' => 6379, - 'timeout' => 0 + 'timeout' => 0, + 'database' => 0 ); /** @@ -113,6 +114,11 @@ class CI_Cache_redis extends CI_Driver { log_message('error', 'Cache: Redis authentication failed.'); } + + if (isset($config['database']) && $config['database'] > 0 && ! $this->_redis->select($config['database'])) + { + log_message('error', 'Cache: Redis select database failed.'); + } } catch (RedisException $e) { -- cgit v1.2.3-24-g4f1b