mirror of
https://github.com/fluencelabs/redis
synced 2025-06-29 08:51:33 +00:00
CLUSTER GETKEYSINSLOT implemented
This commit is contained in:
10
src/db.c
10
src/db.c
@ -725,14 +725,18 @@ void SlotToKeyDel(robj *key) {
|
||||
zslDelete(server.cluster.slots_to_keys,hashslot,key);
|
||||
}
|
||||
|
||||
robj *GetKeyInSlot(unsigned int hashslot) {
|
||||
unsigned int GetKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count) {
|
||||
zskiplistNode *n;
|
||||
zrangespec range;
|
||||
int j = 0;
|
||||
|
||||
range.min = range.max = hashslot;
|
||||
range.minex = range.maxex = 0;
|
||||
|
||||
n = zslFirstInRange(server.cluster.slots_to_keys, range);
|
||||
if (!n) return NULL;
|
||||
return n->obj;
|
||||
while(n && n->score == hashslot && count--) {
|
||||
keys[j++] = n->obj;
|
||||
n = n->level[0].forward;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
Reference in New Issue
Block a user