MCPcopy Create free account
hub / github.com/F-Stack/f-stack / hdelCommand

Function hdelCommand

app/redis-6.2.6/src/t_hash.c:830–856  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

828}
829
830void hdelCommand(client *c) {
831 robj *o;
832 int j, deleted = 0, keyremoved = 0;
833
834 if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
835 checkType(c,o,OBJ_HASH)) return;
836
837 for (j = 2; j < c->argc; j++) {
838 if (hashTypeDelete(o,c->argv[j]->ptr)) {
839 deleted++;
840 if (hashTypeLength(o) == 0) {
841 dbDelete(c->db,c->argv[1]);
842 keyremoved = 1;
843 break;
844 }
845 }
846 }
847 if (deleted) {
848 signalModifiedKey(c,c->db,c->argv[1]);
849 notifyKeyspaceEvent(NOTIFY_HASH,"hdel",c->argv[1],c->db->id);
850 if (keyremoved)
851 notifyKeyspaceEvent(NOTIFY_GENERIC,"del",c->argv[1],
852 c->db->id);
853 server.dirty += deleted;
854 }
855 addReplyLongLong(c,deleted);
856}
857
858void hlenCommand(client *c) {
859 robj *o;

Callers

nothing calls this directly

Calls 8

lookupKeyWriteOrReplyFunction · 0.85
checkTypeFunction · 0.85
hashTypeDeleteFunction · 0.85
hashTypeLengthFunction · 0.85
dbDeleteFunction · 0.85
signalModifiedKeyFunction · 0.85
notifyKeyspaceEventFunction · 0.85
addReplyLongLongFunction · 0.85

Tested by

no test coverage detected