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

Function RM_ServerInfoGetFieldDouble

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

Get the value of a field from data collected with RM_GetServerInfo(). If the * field is not found, or is not a double, return value will be 0, and the * optional out_err argument will be set to REDISMODULE_ERR. */

Source from the content-addressed store, hash-verified

7192 * field is not found, or is not a double, return value will be 0, and the
7193 * optional out_err argument will be set to REDISMODULE_ERR. */
7194double RM_ServerInfoGetFieldDouble(RedisModuleServerInfoData *data, const char* field, int *out_err) {
7195 double dbl;
7196 sds val = raxFind(data->rax, (unsigned char *)field, strlen(field));
7197 if (val == raxNotFound) {
7198 if (out_err) *out_err = REDISMODULE_ERR;
7199 return 0;
7200 }
7201 if (!string2d(val,sdslen(val),&dbl)) {
7202 if (out_err) *out_err = REDISMODULE_ERR;
7203 return 0;
7204 }
7205 if (out_err) *out_err = REDISMODULE_OK;
7206 return dbl;
7207}
7208
7209/* --------------------------------------------------------------------------
7210 * ## Modules utility APIs

Callers

nothing calls this directly

Calls 3

raxFindFunction · 0.85
string2dFunction · 0.85
sdslenFunction · 0.85

Tested by

no test coverage detected