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:
27
phpBB/includes/cache/driver/redis.php
vendored
27
phpBB/includes/cache/driver/redis.php
vendored
@@ -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'))
|
||||
{
|
||||
|
Reference in New Issue
Block a user