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

Function main

lib_acl_cpp/samples/redis/redis_pool/redis_pool.cpp:194–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194int main(int argc, char* argv[])
195{
196 int ch, n = 1, conn_timeout = 10, rw_timeout = 10, dbnum = 0;
197 int max_threads = 10;
198 acl::string addr("127.0.0.1:6379"), cmd, passwd;
199
200 while ((ch = getopt(argc, argv, "hs:n:C:I:c:a:p:d:")) > 0)
201 {
202 switch (ch)
203 {
204 case 'h':
205 usage(argv[0]);
206 return 0;
207 case 's':
208 addr = optarg;
209 break;
210 case 'p':
211 passwd = optarg;
212 break;
213 case 'd':
214 dbnum = atoi(optarg);
215 break;
216 case 'n':
217 n = atoi(optarg);
218 break;
219 case 'C':
220 conn_timeout = atoi(optarg);
221 break;
222 case 'I':
223 rw_timeout = atoi(optarg);
224 break;
225 case 'c':
226 max_threads = atoi(optarg);
227 break;
228 case 'a':
229 cmd = optarg;
230 break;
231 default:
232 break;
233 }
234 }
235
236 acl::acl_cpp_init();
237
238 acl::redis_client_pool pool(addr.c_str(), max_threads);
239 pool.set_timeout(conn_timeout, rw_timeout);
240 if (!passwd.empty())
241 pool.set_password(passwd);
242 if (dbnum > 0)
243 pool.set_db(dbnum);
244
245 std::vector<test_thread*> threads;
246 for (int i = 0; i < max_threads; i++)
247 {
248 test_thread* thread = new test_thread(pool, cmd.c_str(), n);
249 threads.push_back(thread);
250 thread->set_detachable(false);
251 thread->start();

Callers

nothing calls this directly

Calls 13

acl_cpp_initFunction · 0.85
set_passwordMethod · 0.80
set_dbMethod · 0.80
beginMethod · 0.80
usageFunction · 0.70
getoptFunction · 0.50
c_strMethod · 0.45
set_timeoutMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…