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

Function main

lib_acl_cpp/samples/redis/redis_connection/redis_connection.cpp:98–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98int main(int argc, char* argv[])
99{
100 int ch, n = 1, conn_timeout = 10, rw_timeout = 10;
101 acl::string addr("127.0.0.1:6379"), cmd;
102 bool slice_req = false;
103
104 while ((ch = getopt(argc, argv, "hs:n:C:I:a:S")) > 0)
105 {
106 switch (ch)
107 {
108 case 'h':
109 usage(argv[0]);
110 return 0;
111 case 's':
112 addr = optarg;
113 break;
114 case 'n':
115 n = atoi(optarg);
116 break;
117 case 'C':
118 conn_timeout = atoi(optarg);
119 break;
120 case 'I':
121 rw_timeout = atoi(optarg);
122 break;
123 case 'a':
124 cmd = optarg;
125 break;
126 case 'S':
127 slice_req = true;
128 break;
129 default:
130 break;
131 }
132 }
133
134 acl::acl_cpp_init();
135 acl::redis_client client(addr.c_str(), conn_timeout, rw_timeout);
136 client.set_slice_request(slice_req);
137 acl::redis_connection redis(&client);
138
139 bool ret;
140
141 if (cmd == "auth")
142 ret = test_auth(redis);
143 else if (cmd == "echo")
144 ret = test_echo(redis, n);
145 else if (cmd == "ping")
146 ret = test_ping(redis, n);
147 else if (cmd == "quit")
148 ret = test_quit(redis);
149 else if (cmd == "select")
150 ret = test_select(redis, n);
151 else if (cmd == "all")
152 {
153 ret = test_auth(redis)
154 && test_echo(redis, n)
155 && test_ping(redis, n)

Callers

nothing calls this directly

Calls 10

acl_cpp_initFunction · 0.85
test_authFunction · 0.85
test_echoFunction · 0.85
test_pingFunction · 0.85
test_quitFunction · 0.85
usageFunction · 0.70
test_selectFunction · 0.70
getoptFunction · 0.50
c_strMethod · 0.45
set_slice_requestMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…