MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / hdelCommand

Function hdelCommand

src/t_hash.cpp:835–861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected