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-06-07 03:06:33 +0400
committermichael-grunder <michael.grunder@gmail.com>2015-05-06 00:37:23 +0300
commitd5cd5d081f6d1aa183d2a06cdef17ab7511c7f78 (patch)
treeab7e332fe61a28832e1303244a37236b89ae53ea /redis_cluster.h
parent48bf0b57af55ebb8ac82b52e74ef4510d23fb902 (diff)
Added context, HMGET/HMSET
Added context void pointer that we pass around, which is (thus far) really just for hmget (as we need to keep the keys around to bind them with the returned values). This requires every command construction routine and each response callback be passed this void pointer, which is always NULL except for HMGET Added HMGET and HMSET commands
Diffstat (limited to 'redis_cluster.h')
-rw-r--r--redis_cluster.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/redis_cluster.h b/redis_cluster.h
index 636d1e50..4fd5d5f0 100644
--- a/redis_cluster.h
+++ b/redis_cluster.h
@@ -21,11 +21,9 @@
/* Simple 1-1 command -> response macro */
#define CLUSTER_PROCESS_CMD(cmdname, resp_func) \
redisCluster *c = GET_CONTEXT(); \
- char *cmd; \
- int cmd_len; \
- short slot; \
+ char *cmd; int cmd_len; short slot; void *ctx=NULL; \
if(redis_##cmdname##_cmd(INTERNAL_FUNCTION_PARAM_PASSTHRU,c->flags, &cmd, \
- &cmd_len, &slot)==FAILURE) { \
+ &cmd_len, &slot, &ctx)==FAILURE) { \
RETURN_FALSE; \
} \
if(cluster_send_command(c,slot,cmd,cmd_len TSRMLS_CC)<0 || c->err!=NULL) {\
@@ -33,14 +31,14 @@
RETURN_FALSE; \
} \
efree(cmd); \
- resp_func(INTERNAL_FUNCTION_PARAM_PASSTHRU, c);
+ resp_func(INTERNAL_FUNCTION_PARAM_PASSTHRU, c, ctx);
/* More generic processing, where only the keyword differs */
#define CLUSTER_PROCESS_KW_CMD(kw, cmdfunc, resp_func) \
redisCluster *c = GET_CONTEXT(); \
- char *cmd; int cmd_len; short slot; \
+ char *cmd; int cmd_len; short slot; void *ctx=NULL; \
if(cmdfunc(INTERNAL_FUNCTION_PARAM_PASSTHRU, c->flags, kw, &cmd, &cmd_len,\
- &slot)==FAILURE) { \
+ &slot,&ctx)==FAILURE) { \
RETURN_FALSE; \
} \
if(cluster_send_command(c,slot,cmd,cmd_len TSRMLS_CC)<0 || c->err!=NULL) { \
@@ -48,7 +46,7 @@
RETURN_FALSE; \
} \
efree(cmd); \
- resp_func(INTERNAL_FUNCTION_PARAM_PASSTHRU, c);
+ resp_func(INTERNAL_FUNCTION_PARAM_PASSTHRU, c, ctx);
/* For the creation of RedisCluster specific exceptions */
PHPAPI zend_class_entry *rediscluster_get_exception_base(int root TSRMLS_DC);
@@ -100,6 +98,7 @@ PHP_METHOD(RedisCluster, hlen);
PHP_METHOD(RedisCluster, hget);
PHP_METHOD(RedisCluster, hkeys);
PHP_METHOD(RedisCluster, hvals);
+PHP_METHOD(RedisCluster, hmget);
PHP_METHOD(RedisCluster, hmset);
PHP_METHOD(RedisCluster, hgetall);
PHP_METHOD(RedisCluster, hexists);