Get the value of a field from data collected with RM_GetServerInfo(). If the * field is not found, or is not numerical or out of range, return value will be * 0, and the optional out_err argument will be set to REDISMODULE_ERR. */
| 7348 | * field is not found, or is not numerical or out of range, return value will be |
| 7349 | * 0, and the optional out_err argument will be set to REDISMODULE_ERR. */ |
| 7350 | long long RM_ServerInfoGetFieldSigned(RedisModuleServerInfoData *data, const char* field, int *out_err) { |
| 7351 | long long ll; |
| 7352 | sds val = (sds)raxFind(data->rax, (unsigned char *)field, strlen(field)); |
| 7353 | if (val == raxNotFound) { |
| 7354 | if (out_err) *out_err = REDISMODULE_ERR; |
| 7355 | return 0; |
| 7356 | } |
| 7357 | if (!string2ll(val,sdslen(val),&ll)) { |
| 7358 | if (out_err) *out_err = REDISMODULE_ERR; |
| 7359 | return 0; |
| 7360 | } |
| 7361 | if (out_err) *out_err = REDISMODULE_OK; |
| 7362 | return ll; |
| 7363 | } |
| 7364 | |
| 7365 | /* Get the value of a field from data collected with RM_GetServerInfo(). If the |
| 7366 | * field is not found, or is not numerical or out of range, return value will be |