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