summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-09-27 15:34:24 +0200
committerGitHub <noreply@github.com>2016-09-27 15:34:24 +0200
commit5ac3a7beb36b38a95332b90305a0c98dc22cf994 (patch)
tree0bd089501d7f3b9ae5dcf5eb1e106bfb476a1c0a
parent89c9749fb8808eeaa7710128712b33502483b6e0 (diff)
parent7ed227b9075498e307c91a3ae0345755f935a520 (diff)
Merge pull request #4821 from loga4/redis-cache
Cache_redis: Select database index if provided
-rw-r--r--system/libraries/Cache/drivers/Cache_redis.php8
1 files changed, 7 insertions, 1 deletions
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)
{