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

Function moduleUnregisterCommands

src/module.cpp:8719–8739  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8717}
8718
8719void moduleUnregisterCommands(struct RedisModule *module) {
8720 /* Unregister all the commands registered by this module. */
8721 dictIterator *di = dictGetSafeIterator(g_pserver->commands);
8722 dictEntry *de;
8723 while ((de = dictNext(di)) != NULL) {
8724 struct redisCommand *cmd = (redisCommand*)dictGetVal(de);
8725 if (cmd->proc == RedisModuleCommandDispatcher) {
8726 RedisModuleCommandProxy *cp =
8727 (RedisModuleCommandProxy*)(unsigned long)cmd->getkeys_proc;
8728 sds cmdname = (sds)cp->rediscmd->name;
8729 if (cp->module == module) {
8730 dictDelete(g_pserver->commands,cmdname);
8731 dictDelete(g_pserver->orig_commands,cmdname);
8732 sdsfree(cmdname);
8733 zfree(cp->rediscmd);
8734 zfree(cp);
8735 }
8736 }
8737 }
8738 dictReleaseIterator(di);
8739}
8740
8741/* Load a module and initialize it. On success C_OK is returned, otherwise
8742 * C_ERR is returned. */

Callers 2

moduleLoadFunction · 0.85
moduleUnloadFunction · 0.85

Calls 6

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

Tested by

no test coverage detected