| 32 | } |
| 33 | |
| 34 | void _Config_get |
| 35 | ( |
| 36 | RedisModuleCtx *ctx, |
| 37 | RedisModuleString **argv, |
| 38 | int argc |
| 39 | ) { |
| 40 | // return the given config's value to the user |
| 41 | Config_Option_Field config_field; |
| 42 | const char *config_name = RedisModule_StringPtrLen(argv[2], NULL); |
| 43 | |
| 44 | // return entire configuration |
| 45 | if(!strcmp(config_name, "*")) { |
| 46 | _Config_get_all(ctx); |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | // return specific configuration field |
| 51 | if(!Config_Contains_field(config_name, &config_field)) { |
| 52 | RedisModule_ReplyWithError(ctx, "Unknown configuration field"); |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | long long value = 0; |
| 57 | |
| 58 | if(Config_Option_get(config_field, &value)) { |
| 59 | RedisModule_ReplyWithArray(ctx, 2); |
| 60 | RedisModule_ReplyWithCString(ctx, config_name); |
| 61 | RedisModule_ReplyWithLongLong(ctx, value); |
| 62 | } else { |
| 63 | RedisModule_ReplyWithError(ctx, "Configuration field was not found"); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | void _Config_set |
| 68 | ( |
no test coverage detected