X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/6eaad66373982aa9c1c0ff6b584c542670548d0e..35845afba07982407c7ce35dc5df5a70e21cb4f0:/src/t_hash.c?ds=sidebyside diff --git a/src/t_hash.c b/src/t_hash.c index 5e7525bd..4b9b37d6 100644 --- a/src/t_hash.c +++ b/src/t_hash.c @@ -396,17 +396,22 @@ void hmgetCommand(redisClient *c) { void hdelCommand(redisClient *c) { robj *o; + int j, deleted = 0; + if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL || checkType(c,o,REDIS_HASH)) return; - if (hashTypeDelete(o,c->argv[2])) { - if (hashTypeLength(o) == 0) dbDelete(c->db,c->argv[1]); - addReply(c,shared.cone); + for (j = 2; j < c->argc; j++) { + if (hashTypeDelete(o,c->argv[j])) { + if (hashTypeLength(o) == 0) dbDelete(c->db,c->argv[1]); + deleted++; + } + } + if (deleted) { signalModifiedKey(c->db,c->argv[1]); - server.dirty++; - } else { - addReply(c,shared.czero); + server.dirty += deleted; } + addReplyLongLong(c,deleted); } void hlenCommand(redisClient *c) {