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

Function main

lib_acl_cpp/samples/redis/redis/redis.cpp:181–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181int main(int argc, char* argv[])
182{
183 int ch, n = 1, conn_timeout = 10, rw_timeout = 10, dbnum = 0;
184 acl::string addr("127.0.0.1:6379"), command, passwd;
185
186 while ((ch = getopt(argc, argv, "hs:n:C:T:a:p:d:H:")) > 0)
187 {
188 switch (ch)
189 {
190 case 'h':
191 usage(argv[0]);
192 return 0;
193 case 'H':
194 hash_slot(optarg);
195 return 0;
196 case 's':
197 addr = optarg;
198 break;
199 case 'n':
200 n = atoi(optarg);
201 break;
202 case 'C':
203 conn_timeout = atoi(optarg);
204 break;
205 case 'T':
206 rw_timeout = atoi(optarg);
207 break;
208 case 'a':
209 command = optarg;
210 break;
211 case 'p':
212 passwd = optarg;
213 break;
214 case 'd':
215 dbnum = atoi(optarg);
216 break;
217 default:
218 break;
219 }
220 }
221
222 acl::acl_cpp_init();
223 acl::log::stdout_open(true);
224
225 acl::redis_client client(addr.c_str(), conn_timeout, rw_timeout);
226 client.set_password(passwd);
227 if (dbnum > 0)
228 client.set_db(dbnum);
229
230 acl::redis cmd(&client);
231
232 bool ret;
233
234 if (command == "set")
235 ret = test_set(cmd, n);
236 else if (command == "get")
237 ret = test_get(cmd, n);
238 else if (command == "del")

Callers

nothing calls this directly

Calls 14

hash_slotFunction · 0.85
acl_cpp_initFunction · 0.85
set_passwordMethod · 0.80
set_dbMethod · 0.80
usageFunction · 0.70
test_setFunction · 0.70
test_getFunction · 0.70
test_delFunction · 0.70
test_expireFunction · 0.70
test_ttlFunction · 0.70
test_existsFunction · 0.70
test_typeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…