| 3 | static acl::string __keypre("test_key"); |
| 4 | |
| 5 | static bool test_set(acl::redis& cmd, int n) |
| 6 | { |
| 7 | acl::string key, val; |
| 8 | |
| 9 | for (int i = 0; i < n; i++) |
| 10 | { |
| 11 | key.format("%s_%d", __keypre.c_str(), i); |
| 12 | val.format("val_%s", key.c_str()); |
| 13 | cmd.clear(); |
| 14 | if (cmd.set(key, val) == false) |
| 15 | { |
| 16 | printf("set key: %s error: %s\r\n", key.c_str(), |
| 17 | cmd.result_error()); |
| 18 | return false; |
| 19 | } |
| 20 | else if (i < 10) |
| 21 | printf("set key: %s ok\r\n", key.c_str()); |
| 22 | } |
| 23 | |
| 24 | return true; |
| 25 | } |
| 26 | |
| 27 | static bool test_get(acl::redis& cmd, int n) |
| 28 | { |