diff options
author | michael-grunder <michael.grunder@gmail.com> | 2014-07-09 07:14:18 +0400 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2015-05-06 01:02:04 +0300 |
commit | 488cd3c3163be2178fe3354b2304b16fd874ffda (patch) | |
tree | 10b200de2622994cc03343b04774dee55b77af0c /cluster_library.c | |
parent | 4462913cb7b9e46034c719df220cf85f6c400a25 (diff) |
SCAN command
Initial commit of the SCAN command for cluster. As a first iteration,
the command takes a host:port string (which can be retreived from the
introspection method RedisCluster::_masters()), to scan either
everything in the cluster (e.g. in a loop), or one in particular.
A simple way to scan everything in the whole cluster Keyspace
$obj_c->setOption(RedisCluster::OPT_SCAN, RedisCluster::SCAN_RETRY);
foreach($obj_c->_masters() as $str_hash) {
$it = NULL;
while($arr = $obj_c->scan($it, $str_hash)) {
foreach($arr as $key) {
echo "$str_hash -> " . $key . "\n";
}
}
}
Diffstat (limited to 'cluster_library.c')
-rw-r--r-- | cluster_library.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cluster_library.c b/cluster_library.c index a44f4ea2..67e8fc75 100644 --- a/cluster_library.c +++ b/cluster_library.c @@ -1737,7 +1737,7 @@ PHPAPI void cluster_gen_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS, } /* HSCAN, SSCAN, ZSCAN */ -PHPAPI int cluster_kscan_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, +PHPAPI int cluster_scan_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, REDIS_SCAN_TYPE type, long *it) { char *pit; @@ -1774,6 +1774,9 @@ PHPAPI int cluster_kscan_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, // Use the proper response callback depending on scan type switch(type) { + case TYPE_SCAN: + cluster_mbulk_raw_resp(INTERNAL_FUNCTION_PARAM_PASSTHRU,c,NULL); + break; case TYPE_SSCAN: cluster_mbulk_resp(INTERNAL_FUNCTION_PARAM_PASSTHRU,c,NULL); break; |