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

Function sremCommand

src/t_set.cpp:331–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331void sremCommand(client *c) {
332 robj *set;
333 int j, deleted = 0, keyremoved = 0;
334
335 if ((set = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
336 checkType(c,set,OBJ_SET)) return;
337
338 for (j = 2; j < c->argc; j++) {
339 if (setTypeRemove(set,szFromObj(c->argv[j]))) {
340 deleted++;
341 if (setTypeSize(set) == 0) {
342 dbDelete(c->db,c->argv[1]);
343 keyremoved = 1;
344 break;
345 }
346 }
347 }
348 if (deleted) {
349 signalModifiedKey(c,c->db,c->argv[1]);
350 notifyKeyspaceEvent(NOTIFY_SET,"srem",c->argv[1],c->db->id);
351 if (keyremoved)
352 notifyKeyspaceEvent(NOTIFY_GENERIC,"del",c->argv[1],
353 c->db->id);
354 g_pserver->dirty += deleted;
355 }
356 addReplyLongLong(c,deleted);
357}
358
359void smoveCommand(client *c) {
360 robj *srcset, *dstset, *ele;

Callers

nothing calls this directly

Calls 9

lookupKeyWriteOrReplyFunction · 0.85
checkTypeFunction · 0.85
setTypeRemoveFunction · 0.85
szFromObjFunction · 0.85
setTypeSizeFunction · 0.85
dbDeleteFunction · 0.85
signalModifiedKeyFunction · 0.85
notifyKeyspaceEventFunction · 0.85
addReplyLongLongFunction · 0.85

Tested by

no test coverage detected