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

Function test_ttl

lib_acl_cpp/samples/redis/redis_key/redis_key.cpp:48–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48static bool test_ttl(acl::redis_key& redis, int n)
49{
50 acl::string key;
51 int ttl;
52
53 for (int i = 0; i < n; i++)
54 {
55 key.format("%s_%d", __keypre.c_str(), i);
56 redis.clear();
57 if ((ttl = redis.ttl(key.c_str())) < 0)
58 {
59 printf("get ttl key: %s error: %s, ttl=%d\r\n",
60 key.c_str(), redis.result_error(), ttl);
61 return false;
62 }
63 else if (i < 10)
64 printf("ttl ok, key: %s, ttl: %d\r\n",
65 key.c_str(), ttl);
66 }
67
68 return true;
69}
70
71static bool test_exists(acl::redis_key& redis, int n)
72{

Callers 1

mainFunction · 0.70

Calls 5

ttlMethod · 0.80
result_errorMethod · 0.80
formatMethod · 0.45
c_strMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…