diff --git a/src/module.c b/src/module.c index 1671934b8..4dbc57ad6 100644 --- a/src/module.c +++ b/src/module.c @@ -5905,10 +5905,10 @@ size_t RM_MallocSize(void* ptr){ * 0 - no memory limit * 100 and above, memory limit reached. */ -float RM_GetUsedMemoryPercentage(){ +float RM_GetUsedMemoryRatio(){ float level; getMaxmemoryState(NULL, NULL, NULL, &level); - return level * 100; + return level; } /* -------------------------------------------------------------------------- @@ -6991,6 +6991,6 @@ void moduleRegisterCoreAPI(void) { REGISTER_API(BlockClientOnKeys); REGISTER_API(SignalKeyAsReady); REGISTER_API(GetBlockedClientReadyKey); - REGISTER_API(GetUsedMemoryPercentage); + REGISTER_API(GetUsedMemoryRatio); REGISTER_API(MallocSize); } diff --git a/src/redismodule.h b/src/redismodule.h index 259ea2532..c09e03541 100644 --- a/src/redismodule.h +++ b/src/redismodule.h @@ -633,7 +633,7 @@ int REDISMODULE_API_FUNC(RedisModule_CommandFilterArgDelete)(RedisModuleCommandF int REDISMODULE_API_FUNC(RedisModule_Fork)(RedisModuleForkDoneHandler cb, void *user_data); int REDISMODULE_API_FUNC(RedisModule_ExitFromChild)(int retcode); int REDISMODULE_API_FUNC(RedisModule_KillForkChild)(int child_pid); -float REDISMODULE_API_FUNC(RedisModule_GetUsedMemoryPercentage)(); +float REDISMODULE_API_FUNC(RedisModule_GetUsedMemoryRatio)(); size_t REDISMODULE_API_FUNC(RedisModule_MallocSize)(void* ptr); #endif @@ -844,7 +844,7 @@ static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int REDISMODULE_GET_API(Fork); REDISMODULE_GET_API(ExitFromChild); REDISMODULE_GET_API(KillForkChild); - REDISMODULE_GET_API(GetUsedMemoryPercentage); + REDISMODULE_GET_API(GetUsedMemoryRatio); REDISMODULE_GET_API(MallocSize); #endif