Redis Sentinel TLS support
This commit is contained in:
Pavlo Yatsukhnenko
2022-08-07 17:08:15 +03:00
committed by Michael Grunder
parent c4aef95676
commit f2bb2cdb5a
4 changed files with 13 additions and 8 deletions

View File

@@ -47,12 +47,12 @@ PHP_METHOD(RedisSentinel, __construct)
zend_long port = 26379, retry_interval = 0;
redis_sentinel_object *obj;
zend_string *host;
zval *auth = NULL, *zv = NULL;
zval *auth = NULL, *context = NULL, *zv = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ldz!ldz",
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ldz!ldza",
&host, &port, &timeout, &zv,
&retry_interval, &read_timeout,
&auth) == FAILURE) {
&auth, &context) == FAILURE) {
RETURN_FALSE;
}
@@ -92,6 +92,9 @@ PHP_METHOD(RedisSentinel, __construct)
if (auth) {
redis_sock_set_auth_zval(obj->sock, auth);
}
if (context) {
redis_sock_set_stream_context(obj->sock, context);
}
obj->sock->sentinel = 1;
}

View File

@@ -8,7 +8,7 @@
class RedisSentinel {
public function __construct(string $host, int $port = 26379, float $timeout = 0, mixed $persistent = NULL, int $retry_interval = 0, float $read_timeout = 0, #[\SensitiveParameter] mixed $auth = NULL);
public function __construct(string $host, int $port = 26379, float $timeout = 0, mixed $persistent = null, int $retry_interval = 0, float $read_timeout = 0, #[\SensitiveParameter] mixed $auth = null, array $context = null);
/** @return bool|RedisSentinel */
public function ckquorum(string $master);

View File

@@ -1,14 +1,15 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 946942bc5a7612650fc0416902778452f6860d13 */
* Stub hash: 4055ace9f1cf20bef89bdb5d3219470b4c8915e6 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 0, "26379")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_DOUBLE, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent, IS_MIXED, 0, "NULL")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent, IS_MIXED, 0, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, retry_interval, IS_LONG, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, read_timeout, IS_DOUBLE, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, auth, IS_MIXED, 0, "NULL")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, auth, IS_MIXED, 0, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, context, IS_ARRAY, 0, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel_ckquorum, 0, 0, 1)

View File

@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 946942bc5a7612650fc0416902778452f6860d13 */
* Stub hash: 4055ace9f1cf20bef89bdb5d3219470b4c8915e6 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel___construct, 0, 0, 1)
ZEND_ARG_INFO(0, host)
@@ -9,6 +9,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel___construct, 0, 0, 1)
ZEND_ARG_INFO(0, retry_interval)
ZEND_ARG_INFO(0, read_timeout)
ZEND_ARG_INFO(0, auth)
ZEND_ARG_INFO(0, context)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel_ckquorum, 0, 0, 1)