From e6c811cd851cc1b37a0b626458258a26cea0bab3 Mon Sep 17 00:00:00 2001 From: ShooterIT Date: Thu, 6 Aug 2020 15:36:28 +0800 Subject: [PATCH] [Redis-benchmark] Support zset type --- src/redis-benchmark.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index f47cbe333..ef43275b9 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -1733,6 +1733,22 @@ int main(int argc, const char **argv) { free(cmd); } + if (test_is_selected("zadd")) { + char *score = "0"; + if (config.randomkeys) score = "__rand_int__"; + len = redisFormatCommand(&cmd, + "ZADD myzset:{tag} %s element:__rand_int__",score); + benchmark("ZADD",cmd,len); + free(cmd); + } + + if (test_is_selected("zrem")) { + len = redisFormatCommand(&cmd, + "ZREM myzset:{tag} element:__rand_int__"); + benchmark("ZREM",cmd,len); + free(cmd); + } + if (test_is_selected("lrange") || test_is_selected("lrange_100") || test_is_selected("lrange_300") ||