diff options
author | michael-grunder <michael.grunder@gmail.com> | 2014-07-11 19:43:08 +0400 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2015-05-06 01:04:11 +0300 |
commit | 56419cdaa6482a66248f5573168b56b77b544034 (patch) | |
tree | 4d7624815d48fdfa0f92ee3d582e19252383f8f2 | |
parent | a85e04b2fec1697111876256c1461dcbccc1ee4b (diff) |
RANDOMKEY
Implemented RANDOMKEY command for Redis Cluster
-rw-r--r-- | redis_cluster.c | 13 | ||||
-rw-r--r-- | redis_cluster.h | 3 |
2 files changed, 13 insertions, 3 deletions
diff --git a/redis_cluster.c b/redis_cluster.c index adaf9c55..816f0c3c 100644 --- a/redis_cluster.c +++ b/redis_cluster.c @@ -198,6 +198,7 @@ zend_function_entry redis_cluster_functions[] = { PHP_ME(RedisCluster, info, NULL, ZEND_ACC_PUBLIC) PHP_ME(RedisCluster, role, NULL, ZEND_ACC_PUBLIC) PHP_ME(RedisCluster, time, NULL, ZEND_ACC_PUBLIC) + PHP_ME(RedisCluster, randomkey, NULL, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} }; @@ -2237,18 +2238,26 @@ PHP_METHOD(RedisCluster, info) { /* }}} */ /* {{{ proto array RedisCluster::role(string key) - * proto array RedisCluster::role(string key, long port) */ + * proto array RedisCluster::role(string host, long port) */ PHP_METHOD(RedisCluster, role) { cluster_empty_node_cmd(INTERNAL_FUNCTION_PARAM_PASSTHRU, "ROLE", TYPE_MULTIBULK, cluster_variant_resp); } /* {{{ proto array RedisCluster::time(string key) - * proto array RedisCluster::time(string key, long port */ + * proto array RedisCluster::time(string host, long port */ PHP_METHOD(RedisCluster, time) { cluster_empty_node_cmd(INTERNAL_FUNCTION_PARAM_PASSTHRU, "TIME", TYPE_MULTIBULK, cluster_variant_resp); } /* }}} */ +/* {{{ proto string RedisCluster::randomkey(string key) + * proto string RedisCluster::randomkey(string host, long port) */ +PHP_METHOD(RedisCluster, randomkey) { + cluster_empty_node_cmd(INTERNAL_FUNCTION_PARAM_PASSTHRU, "RANDOMKEY", + TYPE_BULK, cluster_bulk_resp); +} +/* }}} */ + /* vim: set tabstop=4 softtabstops=4 noexpandtab shiftwidth=4: */ diff --git a/redis_cluster.h b/redis_cluster.h index 6468e6e7..2097f0b7 100644 --- a/redis_cluster.h +++ b/redis_cluster.h @@ -241,7 +241,7 @@ PHP_METHOD(RedisCluster, discard); PHP_METHOD(RedisCluster, watch); PHP_METHOD(RedisCluster, unwatch); -/* DB saving, server info, etc */ +/* Commands we direct to a node, with no args */ PHP_METHOD(RedisCluster, save); PHP_METHOD(RedisCluster, bgsave); PHP_METHOD(RedisCluster, flushdb); @@ -251,6 +251,7 @@ PHP_METHOD(RedisCluster, bgrewriteaof); PHP_METHOD(RedisCluster, lastsave); PHP_METHOD(RedisCluster, role); PHP_METHOD(RedisCluster, time); +PHP_METHOD(RedisCluster, randomkey); /* Introspection */ PHP_METHOD(RedisCluster, getoption); |