Skip to content

Commit

Permalink
Merge pull request #1719 from vibbow/pr_redis_select_db
Browse files Browse the repository at this point in the history
Update Cache RedisHandler to support select database.
  • Loading branch information
lonnieezell authored Feb 14, 2019
2 parents ccce786 + 8b2bd4c commit f3d4117
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Config/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class Cache extends BaseConfig
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];

/*
Expand Down
6 changes: 6 additions & 0 deletions system/Cache/Handlers/RedisHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class RedisHandler implements CacheInterface
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];

/**
Expand Down Expand Up @@ -118,6 +119,11 @@ public function initialize()
{
// log_message('error', 'Cache: Redis authentication failed.');
}

if (isset($config['database']) && ! $this->redis->select($config['database']))
{
log_message('error', 'Cache: Redis select database failed.');
}
}
catch (\RedisException $e)
{
Expand Down
1 change: 1 addition & 0 deletions user_guide_src/source/libraries/caching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ Available options are::
$config['password'] = NULL;
$config['port'] = 6379;
$config['timeout'] = 0;
$config['database'] = 0;

For more information on Redis, please see
`http://redis.io <http://redis.io>`_.
Expand Down

0 comments on commit f3d4117

Please sign in to comment.