diff --git a/src/redis-cli.c b/src/redis-cli.c index de5d08149..0b44ec252 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -1764,7 +1764,8 @@ static void usage(void) { " --hotkeys Sample Redis keys looking for hot keys.\n" " only works when maxmemory-policy is *lfu.\n" " --scan List all keys using the SCAN command.\n" -" --pattern Useful with --scan to specify a SCAN pattern.\n" +" --pattern Keys pattern when using the --scan, --bigkeys or --hotkeys\n" +" options (default: *).\n" " --intrinsic-latency Run a test to measure intrinsic system latency.\n" " The test will run for the specified amount of seconds.\n" " --eval Send an EVAL command using the Lua script at .\n" @@ -7193,7 +7194,13 @@ static void pipeMode(void) { *--------------------------------------------------------------------------- */ static redisReply *sendScan(unsigned long long *it) { - redisReply *reply = redisCommand(context, "SCAN %llu", *it); + redisReply *reply; + + if (config.pattern) + reply = redisCommand(context,"SCAN %llu MATCH %s", + *it,config.pattern); + else + reply = redisCommand(context,"SCAN %llu",*it); /* Handle any error conditions */ if(reply == NULL) {