mirror of
https://github.com/phpredis/phpredis.git
synced 2026-06-19 07:35:31 +00:00
Update GCRA optional argument from NUM_REQUESTS to TOKENS.
See: https://github.com/redis/redis/pull/14950
This commit is contained in:
committed by
Michael Grunder
parent
9a17083125
commit
5b19731649
+2
-2
@@ -5276,7 +5276,7 @@ class Redis {
|
|||||||
* @param int $maxBurst
|
* @param int $maxBurst
|
||||||
* @param int $requestsPerPeriod
|
* @param int $requestsPerPeriod
|
||||||
* @param int $period
|
* @param int $period
|
||||||
* @param int $numRequests = 0
|
* @param int $tokens = 0
|
||||||
* @return Redis|array|false
|
* @return Redis|array|false
|
||||||
*
|
*
|
||||||
* @see https://redis.io/docs/latest/commands/gcra/
|
* @see https://redis.io/docs/latest/commands/gcra/
|
||||||
@@ -5285,7 +5285,7 @@ class Redis {
|
|||||||
* $redis->gcra('user:123', 10, 100, 3600);
|
* $redis->gcra('user:123', 10, 100, 3600);
|
||||||
*/
|
*/
|
||||||
public function gcra(string $key, int $maxBurst, int $requestsPerPeriod,
|
public function gcra(string $key, int $maxBurst, int $requestsPerPeriod,
|
||||||
int $period, int $numRequests = 0): Redis|array|false;
|
int $period, int $tokens = 0): Redis|array|false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: 190c8ed87be2064ed4cb1c7305576576af10afc6 */
|
* Stub hash: 3ee3118802fef67d6bd7176f2a72f0568d962c8b */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
|
||||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null")
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null")
|
||||||
@@ -1153,7 +1153,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_Redis_gcra, 0, 4, Redi
|
|||||||
ZEND_ARG_TYPE_INFO(0, maxBurst, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, maxBurst, IS_LONG, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, requestsPerPeriod, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, requestsPerPeriod, IS_LONG, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, period, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, period, IS_LONG, 0)
|
||||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, numRequests, IS_LONG, 0, "0")
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tokens, IS_LONG, 0, "0")
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_Redis_xtrim, 0, 2, Redis, MAY_BE_LONG|MAY_BE_FALSE)
|
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_Redis_xtrim, 0, 2, Redis, MAY_BE_LONG|MAY_BE_FALSE)
|
||||||
|
|||||||
@@ -1185,7 +1185,7 @@ class RedisCluster {
|
|||||||
* @see \Redis::gcra()
|
* @see \Redis::gcra()
|
||||||
*/
|
*/
|
||||||
public function gcra(string $key, int $maxBurst, int $requestsPerPeriod,
|
public function gcra(string $key, int $maxBurst, int $requestsPerPeriod,
|
||||||
int $period, int $numRequests = 0): RedisCluster|array|false;
|
int $period, int $tokens = 0): RedisCluster|array|false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: d0720357eca4c563bbd5211bbfbfc6f5a00c4b72 */
|
* Stub hash: 6c7a87611b3bc9039650a3cf2e3c4d4f916611b0 */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
|
||||||
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 1)
|
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 1)
|
||||||
@@ -969,7 +969,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_RedisCluster_gcra, 0,
|
|||||||
ZEND_ARG_TYPE_INFO(0, maxBurst, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, maxBurst, IS_LONG, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, requestsPerPeriod, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, requestsPerPeriod, IS_LONG, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, period, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, period, IS_LONG, 0)
|
||||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, numRequests, IS_LONG, 0, "0")
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tokens, IS_LONG, 0, "0")
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_RedisCluster_xack, 0, 3, RedisCluster, MAY_BE_LONG|MAY_BE_FALSE)
|
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_RedisCluster_xack, 0, 3, RedisCluster, MAY_BE_LONG|MAY_BE_FALSE)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: d0720357eca4c563bbd5211bbfbfc6f5a00c4b72 */
|
* Stub hash: 6c7a87611b3bc9039650a3cf2e3c4d4f916611b0 */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
|
||||||
ZEND_ARG_INFO(0, name)
|
ZEND_ARG_INFO(0, name)
|
||||||
@@ -820,7 +820,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster_gcra, 0, 0, 4)
|
|||||||
ZEND_ARG_INFO(0, maxBurst)
|
ZEND_ARG_INFO(0, maxBurst)
|
||||||
ZEND_ARG_INFO(0, requestsPerPeriod)
|
ZEND_ARG_INFO(0, requestsPerPeriod)
|
||||||
ZEND_ARG_INFO(0, period)
|
ZEND_ARG_INFO(0, period)
|
||||||
ZEND_ARG_INFO(0, numRequests)
|
ZEND_ARG_INFO(0, tokens)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster_xack, 0, 0, 3)
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster_xack, 0, 0, 3)
|
||||||
|
|||||||
+6
-6
@@ -7500,7 +7500,7 @@ redis_vsetattr_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
|
|||||||
int redis_gcra_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
|
int redis_gcra_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
|
||||||
char **cmd, int *cmd_len, short *slot, void **ctx)
|
char **cmd, int *cmd_len, short *slot, void **ctx)
|
||||||
{
|
{
|
||||||
zend_long max_burst, req_per_period, period, count = 0;
|
zend_long max_burst, req_per_period, period, tokens = 0;
|
||||||
smart_string cmdstr = {0};
|
smart_string cmdstr = {0};
|
||||||
zend_string *key;
|
zend_string *key;
|
||||||
|
|
||||||
@@ -7510,18 +7510,18 @@ int redis_gcra_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
|
|||||||
Z_PARAM_LONG(req_per_period)
|
Z_PARAM_LONG(req_per_period)
|
||||||
Z_PARAM_LONG(period)
|
Z_PARAM_LONG(period)
|
||||||
Z_PARAM_OPTIONAL
|
Z_PARAM_OPTIONAL
|
||||||
Z_PARAM_LONG(count)
|
Z_PARAM_LONG(tokens)
|
||||||
ZEND_PARSE_PARAMETERS_END_EX(return FAILURE);
|
ZEND_PARSE_PARAMETERS_END_EX(return FAILURE);
|
||||||
|
|
||||||
REDIS_CMD_INIT_SSTR_STATIC(&cmdstr, 4 + (count > 0 ? 2 : 0), "GCRA");
|
REDIS_CMD_INIT_SSTR_STATIC(&cmdstr, 4 + (tokens > 0 ? 2 : 0), "GCRA");
|
||||||
redis_cmd_append_sstr_key_zstr(&cmdstr, key, redis_sock, slot);
|
redis_cmd_append_sstr_key_zstr(&cmdstr, key, redis_sock, slot);
|
||||||
redis_cmd_append_sstr_long(&cmdstr, max_burst);
|
redis_cmd_append_sstr_long(&cmdstr, max_burst);
|
||||||
redis_cmd_append_sstr_long(&cmdstr, req_per_period);
|
redis_cmd_append_sstr_long(&cmdstr, req_per_period);
|
||||||
redis_cmd_append_sstr_long(&cmdstr, period);
|
redis_cmd_append_sstr_long(&cmdstr, period);
|
||||||
|
|
||||||
if (count > 0) {
|
if (tokens > 0) {
|
||||||
REDIS_CMD_APPEND_SSTR_STATIC(&cmdstr, "NUM_REQUESTS");
|
REDIS_CMD_APPEND_SSTR_STATIC(&cmdstr, "TOKENS");
|
||||||
redis_cmd_append_sstr_long(&cmdstr, count);
|
redis_cmd_append_sstr_long(&cmdstr, tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
*cmd = cmdstr.c;
|
*cmd = cmdstr.c;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: 190c8ed87be2064ed4cb1c7305576576af10afc6 */
|
* Stub hash: 3ee3118802fef67d6bd7176f2a72f0568d962c8b */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
|
||||||
ZEND_ARG_INFO(0, options)
|
ZEND_ARG_INFO(0, options)
|
||||||
@@ -1021,7 +1021,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_gcra, 0, 0, 4)
|
|||||||
ZEND_ARG_INFO(0, maxBurst)
|
ZEND_ARG_INFO(0, maxBurst)
|
||||||
ZEND_ARG_INFO(0, requestsPerPeriod)
|
ZEND_ARG_INFO(0, requestsPerPeriod)
|
||||||
ZEND_ARG_INFO(0, period)
|
ZEND_ARG_INFO(0, period)
|
||||||
ZEND_ARG_INFO(0, numRequests)
|
ZEND_ARG_INFO(0, tokens)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_xtrim, 0, 0, 2)
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_xtrim, 0, 0, 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user