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

Function smismemberCommand

src/t_set.cpp:426–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424}
425
426void smismemberCommand(client *c) {
427 robj_roptr set;
428 int j;
429
430 /* Don't abort when the key cannot be found. Non-existing keys are empty
431 * sets, where SMISMEMBER should respond with a series of zeros. */
432 set = lookupKeyRead(c->db,c->argv[1]);
433 if (set && checkType(c,set,OBJ_SET)) return;
434
435 addReplyArrayLen(c,c->argc - 2);
436
437 for (j = 2; j < c->argc; j++) {
438 if (set && setTypeIsMember(set,szFromObj(c->argv[j])))
439 addReply(c,shared.cone);
440 else
441 addReply(c,shared.czero);
442 }
443}
444
445void scardCommand(client *c) {
446 robj_roptr o;

Callers

nothing calls this directly

Calls 6

lookupKeyReadFunction · 0.85
checkTypeFunction · 0.85
addReplyArrayLenFunction · 0.85
setTypeIsMemberFunction · 0.85
szFromObjFunction · 0.85
addReplyFunction · 0.85

Tested by

no test coverage detected