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. */
| 7303 | * |
| 7304 | * The number of unregistered APIs is returned. */ |
| 7305 | int 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. |
no test coverage detected