| 4 | static acl::string __keypre("test_key"); |
| 5 | |
| 6 | static bool test_set(acl::redis_string& redis, int n) |
| 7 | { |
| 8 | acl::string key; |
| 9 | acl::string value; |
| 10 | |
| 11 | for (int i = 0; i < n; i++) |
| 12 | { |
| 13 | key.format("%s_%d", __keypre.c_str(), i); |
| 14 | value.format("value_%s", key.c_str()); |
| 15 | |
| 16 | redis.clear(); |
| 17 | redis.set_check_addr(__check_addr); |
| 18 | if (redis.set(key.c_str(), value.c_str(), 100, SETFLAG_EX | SETFLAG_NX) == false) |
| 19 | { |
| 20 | printf("set key: %s error: %s\r\n", |
| 21 | key.c_str(), redis.result_error()); |
| 22 | return false; |
| 23 | } |
| 24 | else if (i < 10) |
| 25 | printf("set key: %s ok\r\n", key.c_str()); |
| 26 | } |
| 27 | |
| 28 | return true; |
| 29 | } |
| 30 | |
| 31 | static bool test_setex(acl::redis_string& redis, int n, int ttl) |
| 32 | { |
no test coverage detected
searching dependent graphs…