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

Function RM_GetSharedAPI

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

Request an exported API pointer. The return value is just a void pointer * that the caller of this function will be required to cast to the right * function pointer, so this is a private contract between modules. * * If the requested API is not available then NULL is returned. Because * modules can be loaded at different times with different order, this * function calls should be put inside

Source from the content-addressed store, hash-verified

7286 * }
7287 */
7288void *RM_GetSharedAPI(RedisModuleCtx *ctx, const char *apiname) {
7289 dictEntry *de = dictFind(server.sharedapi, apiname);
7290 if (de == NULL) return NULL;
7291 RedisModuleSharedAPI *sapi = dictGetVal(de);
7292 if (listSearchKey(sapi->module->usedby,ctx->module) == NULL) {
7293 listAddNodeTail(sapi->module->usedby,ctx->module);
7294 listAddNodeTail(ctx->module->using,sapi->module);
7295 }
7296 return sapi->func;
7297}
7298
7299/* Remove all the APIs registered by the specified module. Usually you
7300 * want this when the module is going to be unloaded. This function

Callers

nothing calls this directly

Calls 3

listSearchKeyFunction · 0.85
listAddNodeTailFunction · 0.85
dictFindFunction · 0.70

Tested by

no test coverage detected