| 259 | } |
| 260 | |
| 261 | bool RedisClient::GetConfig(TDicConfig& dicConfig) |
| 262 | { |
| 263 | dicConfig.clear(); |
| 264 | redisReply* reply = Command("CONFIG GET *"); |
| 265 | if (!reply) return false; |
| 266 | if (reply->type != REDIS_REPLY_ARRAY) |
| 267 | { |
| 268 | freeReplyObject(reply); |
| 269 | return false; |
| 270 | } |
| 271 | std::size_t i = 0; |
| 272 | std::string configKey , configValue; |
| 273 | redisReply* tmpReply ; |
| 274 | while (i < reply->elements) |
| 275 | { |
| 276 | tmpReply = reply->element[i++]; |
| 277 | configKey.assign(tmpReply->str, tmpReply->len); |
| 278 | tmpReply = reply->element[i++]; |
| 279 | configValue.assign(tmpReply->str, tmpReply->len); |
| 280 | dicConfig.insert(std::make_pair(configKey, configValue)); |
| 281 | } |
| 282 | freeReplyObject(reply); |
| 283 | return true; |
| 284 | } |
| 285 | |
| 286 | bool RedisClient::SetConfig(const TDicConfig& dicConfig) |
| 287 | { |
nothing calls this directly
no test coverage detected