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

Function zremCommand

app/redis-6.2.6/src/t_zset.c:1856–1881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1854}
1855
1856void zremCommand(client *c) {
1857 robj *key = c->argv[1];
1858 robj *zobj;
1859 int deleted = 0, keyremoved = 0, j;
1860
1861 if ((zobj = lookupKeyWriteOrReply(c,key,shared.czero)) == NULL ||
1862 checkType(c,zobj,OBJ_ZSET)) return;
1863
1864 for (j = 2; j < c->argc; j++) {
1865 if (zsetDel(zobj,c->argv[j]->ptr)) deleted++;
1866 if (zsetLength(zobj) == 0) {
1867 dbDelete(c->db,key);
1868 keyremoved = 1;
1869 break;
1870 }
1871 }
1872
1873 if (deleted) {
1874 notifyKeyspaceEvent(NOTIFY_ZSET,"zrem",key,c->db->id);
1875 if (keyremoved)
1876 notifyKeyspaceEvent(NOTIFY_GENERIC,"del",key,c->db->id);
1877 signalModifiedKey(c,c->db,key);
1878 server.dirty += deleted;
1879 }
1880 addReplyLongLong(c,deleted);
1881}
1882
1883typedef enum {
1884 ZRANGE_AUTO = 0,

Callers

nothing calls this directly

Calls 8

lookupKeyWriteOrReplyFunction · 0.85
checkTypeFunction · 0.85
zsetDelFunction · 0.85
zsetLengthFunction · 0.85
dbDeleteFunction · 0.85
notifyKeyspaceEventFunction · 0.85
signalModifiedKeyFunction · 0.85
addReplyLongLongFunction · 0.85

Tested by

no test coverage detected