diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2012-12-01 00:48:21 -0500 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-12-01 00:48:21 -0500 |
commit | c852044d6eecc0a652800b1661491c0f9c545054 (patch) | |
tree | 3b5777cf4fa1c3fb76293c227e1eb86d7171e187 /phpBB/includes/cache/driver/redis.php | |
parent | 3a702084e4249830a87dc0914127e00c1bb1b1dd (diff) | |
download | forums-c852044d6eecc0a652800b1661491c0f9c545054.tar forums-c852044d6eecc0a652800b1661491c0f9c545054.tar.gz forums-c852044d6eecc0a652800b1661491c0f9c545054.tar.bz2 forums-c852044d6eecc0a652800b1661491c0f9c545054.tar.xz forums-c852044d6eecc0a652800b1661491c0f9c545054.zip |
[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
Diffstat (limited to 'phpBB/includes/cache/driver/redis.php')
-rw-r--r-- | phpBB/includes/cache/driver/redis.php | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/phpBB/includes/cache/driver/redis.php b/phpBB/includes/cache/driver/redis.php index d256b5600e..ae6f9e04f2 100644 --- a/phpBB/includes/cache/driver/redis.php +++ b/phpBB/includes/cache/driver/redis.php @@ -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')) { |