| 299 | } |
| 300 | |
| 301 | static bool test_setrange(acl::redis_string& redis, int n) |
| 302 | { |
| 303 | acl::string key, value; |
| 304 | unsigned int off = 5; |
| 305 | int ret; |
| 306 | |
| 307 | for (int i = 0; i < n; i++) |
| 308 | { |
| 309 | key.format("%s_%d", __keypre.c_str(), i); |
| 310 | value.format("range_value_%s", key.c_str()); |
| 311 | |
| 312 | redis.clear(); |
| 313 | ret = redis.setrange(key.c_str(), off, value.c_str()); |
| 314 | if (ret < 0) |
| 315 | { |
| 316 | printf("setrange error: %s, key: %s, off: %u, value: %s\r\n", |
| 317 | redis.result_error(), key.c_str(), off, value.c_str()); |
| 318 | return false; |
| 319 | } |
| 320 | else if (i < 10) |
| 321 | printf("setrange ok, key: %s, off: %u, value: %s\r\n", |
| 322 | key.c_str(), off, value.c_str()); |
| 323 | } |
| 324 | |
| 325 | return true; |
| 326 | } |
| 327 | |
| 328 | static bool test_getrange(acl::redis_string& redis, int n) |
| 329 | { |