diff options
author | michael-grunder <michael.grunder@gmail.com> | 2022-10-08 19:18:04 +0300 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2022-10-08 19:23:13 +0300 |
commit | 6ea978eb72507c3c21805de8bc916b1aa7f0f0dd (patch) | |
tree | 31c0d8d6d3b8bb036ae8ba2ffcb99d089039585d /cluster_library.c | |
parent | bebd398c67eaba7d7f612bc1bf5f07a7470787f2 (diff) |
[B]LMPOP and [B]ZMPOP commands
Implement the new Redis 7.0.0 commands to pop multiple elements from one
or more lists/zsets.
Additionally, remove INTERNAL_FUNCTION_PARAMETERS from the
redis_sock_read_multibulk_reply_zval helper function as it wasn't
actually being used.
Diffstat (limited to 'cluster_library.c')
-rw-r--r-- | cluster_library.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cluster_library.c b/cluster_library.c index c76c3269..fe574e50 100644 --- a/cluster_library.c +++ b/cluster_library.c @@ -2362,6 +2362,23 @@ cluster_xinfo_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, void *ctx) add_next_index_zval(&c->multi_resp, &z_ret); } +/* LMPOP, ZMPOP, BLMPOP, BZMPOP */ +PHP_REDIS_API void +cluster_mpop_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, void *ctx) +{ + zval z_ret; + + c->cmd_sock->null_mbulk_as_null = c->flags->null_mbulk_as_null; + if (redis_read_mpop_response(c->cmd_sock, &z_ret, c->reply_len, ctx) == FAILURE) { + CLUSTER_RETURN_FALSE(c); + } + + if (CLUSTER_IS_ATOMIC(c)) { + RETURN_ZVAL(&z_ret, 0, 0); + } + add_next_index_zval(&c->multi_resp, &z_ret); +} + static void cluster_acl_custom_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, void *ctx, int (*cb)(RedisSock*, zval*, long)) |