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

Function moduleUnregisterSharedAPI

src/module.cpp:7497–7512  ·  view source on GitHub ↗

Remove all the APIs registered by the specified module. Usually you * want this when the module is going to be unloaded. This function * assumes that's caller responsibility to make sure the APIs are not * used by other modules. * * The number of unregistered APIs is returned. */

Source from the content-addressed store, hash-verified

7495 *
7496 * The number of unregistered APIs is returned. */
7497int moduleUnregisterSharedAPI(RedisModule *module) {
7498 int count = 0;
7499 dictIterator *di = dictGetSafeIterator(g_pserver->sharedapi);
7500 dictEntry *de;
7501 while ((de = dictNext(di)) != NULL) {
7502 const char *apiname = (const char*)dictGetKey(de);
7503 RedisModuleSharedAPI *sapi = (RedisModuleSharedAPI*)dictGetVal(de);
7504 if (sapi->module == module) {
7505 dictDelete(g_pserver->sharedapi,apiname);
7506 zfree(sapi);
7507 count++;
7508 }
7509 }
7510 dictReleaseIterator(di);
7511 return count;
7512}
7513
7514/* Remove the specified module as an user of APIs of ever other module.
7515 * This is usually called when a module is unloaded.

Callers 2

moduleLoadFunction · 0.85
moduleUnloadFunction · 0.85

Calls 5

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

Tested by

no test coverage detected