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

Function moduleUnregisterSharedAPI

app/redis-6.2.6/src/module.c:7305–7320  ·  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

7303 *
7304 * The number of unregistered APIs is returned. */
7305int moduleUnregisterSharedAPI(RedisModule *module) {
7306 int count = 0;
7307 dictIterator *di = dictGetSafeIterator(server.sharedapi);
7308 dictEntry *de;
7309 while ((de = dictNext(di)) != NULL) {
7310 const char *apiname = dictGetKey(de);
7311 RedisModuleSharedAPI *sapi = dictGetVal(de);
7312 if (sapi->module == module) {
7313 dictDelete(server.sharedapi,apiname);
7314 zfree(sapi);
7315 count++;
7316 }
7317 }
7318 dictReleaseIterator(di);
7319 return count;
7320}
7321
7322/* Remove the specified module as an user of APIs of ever other module.
7323 * This is usually called when a module is unloaded.

Callers 2

moduleLoadFunction · 0.85
moduleUnloadFunction · 0.85

Calls 5

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

Tested by

no test coverage detected