| 326 | } |
| 327 | |
| 328 | static bool test_getrange(acl::redis_string& redis, int n) |
| 329 | { |
| 330 | acl::string key, value; |
| 331 | int start = 5, end = 10; |
| 332 | |
| 333 | for (int i = 0; i < n; i++) |
| 334 | { |
| 335 | key.format("%s_%d", __keypre.c_str(), i); |
| 336 | value.clear(); |
| 337 | |
| 338 | redis.clear(); |
| 339 | if (redis.getrange(key, start, end, value) == false) |
| 340 | { |
| 341 | printf("getrange error: %s, key: %s, start: %d, end: %d\r\n", |
| 342 | redis.result_error(), key.c_str(), start, end); |
| 343 | return false; |
| 344 | } |
| 345 | else if (i >= 10) |
| 346 | continue; |
| 347 | |
| 348 | printf("getrange ok, key: %s, start: %d, end: %d, value: %s\r\n", |
| 349 | key.c_str(), start, end, value.c_str()); |
| 350 | } |
| 351 | |
| 352 | return true; |
| 353 | } |
| 354 | |
| 355 | static bool test_setbit(acl::redis_string& redis, int n) |
| 356 | { |