mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Cluster: new sub-command CLUSTER COUNTKEYSINSLOT.
The new sub-command uses the new countKeysInSlot() API and allows a cluster client to get the number of keys for a given hashslot.
This commit is contained in:
parent
a517c89321
commit
d4fa40655d
@ -1640,6 +1640,12 @@ void clusterCommand(redisClient *c) {
|
||||
sds key = c->argv[2]->ptr;
|
||||
|
||||
addReplyLongLong(c,keyHashSlot(key,sdslen(key)));
|
||||
} else if (!strcasecmp(c->argv[1]->ptr,"countkeysinslot") && c->argc == 3) {
|
||||
long long slot;
|
||||
|
||||
if (getLongLongFromObjectOrReply(c,c->argv[2],&slot,NULL) != REDIS_OK)
|
||||
return;
|
||||
addReplyLongLong(c,countKeysInSlot(slot));
|
||||
} else if (!strcasecmp(c->argv[1]->ptr,"getkeysinslot") && c->argc == 4) {
|
||||
long long maxkeys, slot;
|
||||
unsigned int numkeys, j;
|
||||
|
Loading…
Reference in New Issue
Block a user