diff options
Diffstat (limited to 'src/module.c')
-rw-r--r-- | src/module.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/module.c b/src/module.c index 0027692c4..bec844edf 100644 --- a/src/module.c +++ b/src/module.c @@ -7990,7 +7990,7 @@ int RM_ScanKey(RedisModuleKey *key, RedisModuleScanCursor *cursor, RedisModuleSc cursor->cursor = 1; cursor->done = 1; ret = 0; - } else if (o->type == OBJ_HASH || o->type == OBJ_ZSET) { + } else if (o->type == OBJ_ZSET) { unsigned char *p = ziplistIndex(o->ptr,0); unsigned char *vstr; unsigned int vlen; @@ -8013,6 +8013,25 @@ int RM_ScanKey(RedisModuleKey *key, RedisModuleScanCursor *cursor, RedisModuleSc cursor->cursor = 1; cursor->done = 1; ret = 0; + } else if (o->type == OBJ_HASH) { + unsigned char *p = lpFirst(o->ptr); + unsigned char *vstr; + int64_t vlen; + unsigned char intbuf[LP_INTBUF_SIZE]; + while(p) { + vstr = lpGet(p,&vlen,intbuf); + robj *field = createStringObject((char*)vstr,vlen); + p = lpNext(o->ptr,p); + vstr = lpGet(p,&vlen,intbuf); + robj *value = createStringObject((char*)vstr,vlen); + fn(key, field, value, privdata); + p = lpNext(o->ptr,p); + decrRefCount(field); + decrRefCount(value); + } + cursor->cursor = 1; + cursor->done = 1; + ret = 0; } errno = 0; return ret; |