1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/9983] Add redis cache driver tests.

In order to not overwrite data in default redis store, at least
one of redis host or post must be explicitly specified.

Redis cache driver constructor has been modified to accept
host and port as parameters. This was not added to public API
as there are more parameters being passed via global constants.

PHPBB3-9983
This commit is contained in:
Oleg Pudeyev
2012-12-01 00:48:21 -05:00
parent 3a702084e4
commit c852044d6e
4 changed files with 126 additions and 3 deletions

View File

@@ -39,13 +39,38 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
var $redis;
/**
* Creates a redis cache driver.
*
* The following global constants affect operation:
*
* PHPBB_ACM_REDIS_HOST
* PHPBB_ACM_REDIS_PORT
* PHPBB_ACM_REDIS_PASSWORD
* PHPBB_ACM_REDIS_DB
*
* There are no publicly documented constructor parameters.
*/
function __construct()
{
// Call the parent constructor
parent::__construct();
$this->redis = new Redis();
$this->redis->connect(PHPBB_ACM_REDIS_HOST, PHPBB_ACM_REDIS_PORT);
$args = func_get_args();
if (!empty($args))
{
$ok = call_user_func_array(array($this->redis, 'connect'), $args);
}
else
{
$ok = $this->redis->connect(PHPBB_ACM_REDIS_HOST, PHPBB_ACM_REDIS_PORT);
}
if (!$ok)
{
trigger_error('Could not connect to redis server');
}
if (defined('PHPBB_ACM_REDIS_PASSWORD'))
{