MCPcopy Create free account
hub / github.com/acl-dev/acl / cluster_info

Method cluster_info

lib_acl_cpp/src/redis/redis_cluster.cpp:377–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375}
376
377bool redis_cluster::cluster_info(std::map<string, string>& result)
378{
379 const char* argv[2];
380 size_t lens[2];
381
382 argv[0] = "CLUSTER";
383 lens[0] = sizeof("CLUSTER") - 1;
384
385 argv[1] = "INFO";
386 lens[1] = sizeof("INFO") - 1;
387
388 build_request(2, argv, lens);
389
390 string buf;
391 if (get_string(buf) <= 0) {
392 return false;
393 }
394
395 string line;
396
397 while (true) {
398 line.clear();
399 if (!buf.scan_line(line)) {
400 break;
401 }
402
403 char* name = line.c_str();
404 char* value = strchr(name, ':');
405 if (value == NULL || *(value + 1) == 0) {
406 continue;
407 }
408 *value++ = 0;
409 result[name] = value;
410 }
411
412 return true;
413}
414
415bool redis_cluster::cluster_saveconfig()
416{

Callers 1

test_infoFunction · 0.80

Calls 4

scan_lineMethod · 0.80
build_requestFunction · 0.50
clearMethod · 0.45
c_strMethod · 0.45

Tested by 1

test_infoFunction · 0.64