Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2014-07-11 04:49:14 +0400
committermichael-grunder <michael.grunder@gmail.com>2015-05-06 01:03:10 +0300
commit59038f4232fe3de5a1380516be54300078a499c5 (patch)
tree38a2bb8acf63832ef4c12d650563feacfd8d0c84 /cluster_library.c
parentc4b664439759518e810a956cd369f16183ca48ca (diff)
INFO command as well as a direct slot tweak
This commit implements the INFO command for RedisCluster, which behaves like other direct to node commands and can take either a key or a host and port. Updated cluster_send_slot function such that on success it sets the proper reply slot.
Diffstat (limited to 'cluster_library.c')
-rw-r--r--cluster_library.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/cluster_library.c b/cluster_library.c
index 67e8fc75..e4354fc3 100644
--- a/cluster_library.c
+++ b/cluster_library.c
@@ -1221,6 +1221,9 @@ PHPAPI int cluster_send_slot(redisCluster *c, short slot, char *cmd,
return -1;
}
+ // Update our reply slot
+ c->reply_slot = slot;
+
return 0;
}
@@ -1794,6 +1797,33 @@ PHPAPI int cluster_scan_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
return SUCCESS;
}
+/* INFO response */
+PHPAPI void cluster_info_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
+ void *ctx)
+{
+ zval *z_result;
+ char *info, *p;
+
+ // Read our bulk response
+ if((info = redis_sock_read_bulk_reply(SLOT_SOCK(c,c->reply_slot),
+ c->reply_len TSRMLS_CC))==NULL)
+ {
+ CLUSTER_RETURN_FALSE(c);
+ }
+
+ /* Parse response, free memory */
+ z_result = redis_parse_info_response(info);
+ efree(info);
+
+ // Return our array
+ if(CLUSTER_IS_ATOMIC(c)) {
+ *return_value = *z_result;
+ efree(z_result);
+ } else {
+ add_next_index_zval(c->multi_resp, z_result);
+ }
+}
+
/* MULTI BULK response loop where we might pull the next one */
PHPAPI zval *cluster_zval_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
redisCluster *c, int pull, mbulk_cb cb)