| 214 | } |
| 215 | |
| 216 | static bool test_mget(acl::redis_string& redis, int n) |
| 217 | { |
| 218 | acl::string key1, key2, key3; |
| 219 | std::vector<acl::string> result; |
| 220 | const char* keys[3]; |
| 221 | |
| 222 | for (int i = 0; i < n; i++) |
| 223 | { |
| 224 | key1.format("key1_%s_%d", __keypre.c_str(), i); |
| 225 | key2.format("key2_%s_%d", __keypre.c_str(), i); |
| 226 | key3.format("key3_%s_%d", __keypre.c_str(), i); |
| 227 | keys[0] = key1.c_str(); |
| 228 | keys[1] = key2.c_str(); |
| 229 | keys[2] = key3.c_str(); |
| 230 | |
| 231 | result.clear(); |
| 232 | redis.clear(); |
| 233 | if (redis.mget(keys, 3, &result) == false) |
| 234 | { |
| 235 | printf("mset error: %s\r\n", redis.result_error()); |
| 236 | return false; |
| 237 | } |
| 238 | else if (i >= 10) |
| 239 | continue; |
| 240 | |
| 241 | size_t size = redis.result_size(); |
| 242 | printf("size: %lu\r\n", (unsigned long) size); |
| 243 | |
| 244 | size_t j; |
| 245 | for (j = 0; j < size; j++) |
| 246 | { |
| 247 | const char* val = redis.result_value(j); |
| 248 | printf("mget ok, %s=%s\r\n", |
| 249 | keys[j], val ? val : "null"); |
| 250 | } |
| 251 | |
| 252 | std::vector<acl::string>::const_iterator it= result.begin(); |
| 253 | for (j = 0; it != result.end(); ++it, j++) |
| 254 | printf("mget %s=%s\r\n", keys[j], (*it).c_str()); |
| 255 | } |
| 256 | |
| 257 | return true; |
| 258 | } |
| 259 | |
| 260 | static bool test_msetnx(acl::redis_string& redis, int n) |
| 261 | { |
no test coverage detected
searching dependent graphs…