| 91 | } |
| 92 | |
| 93 | static bool test_ttl(acl::redis& cmd, int n) |
| 94 | { |
| 95 | acl::string key; |
| 96 | int ttl; |
| 97 | |
| 98 | for (int i = 0; i < n; i++) |
| 99 | { |
| 100 | key.format("%s_%d", __keypre.c_str(), i); |
| 101 | cmd.clear(); |
| 102 | if ((ttl = cmd.ttl(key.c_str())) < 0) |
| 103 | { |
| 104 | printf("get ttl key: %s error: %s\r\n", key.c_str(), |
| 105 | cmd.result_error()); |
| 106 | return false; |
| 107 | } |
| 108 | else if (i < 10) |
| 109 | printf("ttl ok, key: %s, ttl: %d\r\n", |
| 110 | key.c_str(), ttl); |
| 111 | } |
| 112 | |
| 113 | return true; |
| 114 | } |
| 115 | |
| 116 | static bool test_exists(acl::redis& cmd, int n) |
| 117 | { |