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

Function sremCommand

app/redis-6.2.6/src/t_set.c:326–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected