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

Function moduleUnregisterCommands

app/redis-6.2.6/src/module.c:8519–8539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8517}
8518
8519void moduleUnregisterCommands(struct RedisModule *module) {
8520 /* Unregister all the commands registered by this module. */
8521 dictIterator *di = dictGetSafeIterator(server.commands);
8522 dictEntry *de;
8523 while ((de = dictNext(di)) != NULL) {
8524 struct redisCommand *cmd = dictGetVal(de);
8525 if (cmd->proc == RedisModuleCommandDispatcher) {
8526 RedisModuleCommandProxy *cp =
8527 (void*)(unsigned long)cmd->getkeys_proc;
8528 sds cmdname = cp->rediscmd->name;
8529 if (cp->module == module) {
8530 dictDelete(server.commands,cmdname);
8531 dictDelete(server.orig_commands,cmdname);
8532 sdsfree(cmdname);
8533 zfree(cp->rediscmd);
8534 zfree(cp);
8535 }
8536 }
8537 }
8538 dictReleaseIterator(di);
8539}
8540
8541/* Load a module and initialize it. On success C_OK is returned, otherwise
8542 * C_ERR is returned. */

Callers 2

moduleLoadFunction · 0.85
moduleUnloadFunction · 0.85

Calls 6

dictGetSafeIteratorFunction · 0.85
sdsfreeFunction · 0.85
dictNextFunction · 0.70
dictDeleteFunction · 0.70
zfreeFunction · 0.70
dictReleaseIteratorFunction · 0.70

Tested by

no test coverage detected