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

Function main

lib_acl_cpp/samples/session/session.cpp:16–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16int main(int argc, char* argv[])
17{
18 char addr[256], action[32];
19 int nloop = 10, ch, max_threads = 1;
20
21 acl::acl_cpp_init();
22
23 acl::safe_snprintf(action, sizeof(action), "redis");
24 acl::safe_snprintf(addr, sizeof(addr), "192.168.0.250:11211");
25
26 while ((ch = getopt(argc, argv, "hs:n:c:a:")) > 0)
27 {
28 switch (ch)
29 {
30 case 'h':
31 usage(argv[0]);
32 return 0;
33 case 's':
34 acl::safe_snprintf(addr, sizeof(addr), "%s", optarg);
35 break;
36 case 'n':
37 nloop = atoi(optarg);
38 if (nloop <= 0)
39 nloop = 10;
40 break;
41 case 'c':
42 max_threads = atoi(optarg);
43 break;
44 case 'a':
45 acl::safe_snprintf(action, sizeof(action), "%s", optarg);
46 break;
47 default:
48 break;
49 }
50 }
51
52 printf("nloop: %d, max_threads: %d\r\n", nloop, max_threads);
53
54 if (strcasecmp(action, "memcache") == 0)
55 test_memcache_session(addr, nloop);
56 else if (strcasecmp(action, "memcache_delay") == 0)
57 test_memcache_session_delay(addr);
58 else if (strcasecmp(action, "redis") == 0)
59 test_redis_session(addr, nloop, max_threads);
60 else if (strcasecmp(action, "redis_attrs") == 0)
61 test_redis_session_attrs(addr, nloop);
62 else
63 printf("unknown action: %s\r\n", action);
64
65#ifdef WIN32
66 printf("enter any key to exit\r\n");
67 getchar();
68#endif
69 return 0;
70}
71

Callers

nothing calls this directly

Calls 8

acl_cpp_initFunction · 0.85
safe_snprintfFunction · 0.85
test_memcache_sessionFunction · 0.85
test_redis_sessionFunction · 0.85
test_redis_session_attrsFunction · 0.85
usageFunction · 0.70
getoptFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…