diff --git a/src/redis.c b/src/redis.c index 649c7766..d4ff261f 100644 --- a/src/redis.c +++ b/src/redis.c @@ -179,6 +179,7 @@ struct redisCommand redisCommandTable[] = { {"zscore",zscoreCommand,3,"r",0,NULL,1,1,1,0,0}, {"zrank",zrankCommand,3,"r",0,NULL,1,1,1,0,0}, {"zrevrank",zrevrankCommand,3,"r",0,NULL,1,1,1,0,0}, + {"zscan",zscanCommand,-3,"rR",0,NULL,1,1,1,0,0}, {"hset",hsetCommand,4,"wm",0,NULL,1,1,1,0,0}, {"hsetnx",hsetnxCommand,4,"wm",0,NULL,1,1,1,0,0}, {"hget",hgetCommand,3,"r",0,NULL,1,1,1,0,0}, diff --git a/src/redis.h b/src/redis.h index 16ec5ae8..aecbcb86 100644 --- a/src/redis.h +++ b/src/redis.h @@ -1304,6 +1304,7 @@ void hlenCommand(redisClient *c); void zremrangebyrankCommand(redisClient *c); void zunionstoreCommand(redisClient *c); void zinterstoreCommand(redisClient *c); +void zscanCommand(redisClient *c); void hkeysCommand(redisClient *c); void hvalsCommand(redisClient *c); void hgetallCommand(redisClient *c); diff --git a/src/t_zset.c b/src/t_zset.c index b4cb9d00..9178bf55 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -2204,3 +2204,11 @@ void zrankCommand(redisClient *c) { void zrevrankCommand(redisClient *c) { zrankGenericCommand(c, 1); } + +void zscanCommand(redisClient *c) { + robj *o; + + if ((o= lookupKeyReadOrReply(c,c->argv[1],shared.emptyscan)) == NULL || + checkType(c,o,REDIS_ZSET)) return; + scanGenericCommand(c,o); +}