| 352 | } |
| 353 | |
| 354 | double redis_geo::geodist(const char* key, const char* member1, |
| 355 | const char* member2, int unit /* = GEO_UNIT_M */) |
| 356 | { |
| 357 | const char* names[3]; |
| 358 | names[0] = member1; |
| 359 | names[1] = member2; |
| 360 | |
| 361 | size_t argc = 2; |
| 362 | |
| 363 | const char* unit_s = get_unit(unit); |
| 364 | if (unit_s != NULL) |
| 365 | { |
| 366 | names[2] = unit_s; |
| 367 | argc++; |
| 368 | } |
| 369 | |
| 370 | hash_slot(key); |
| 371 | build("GEODIST", key, names, argc); |
| 372 | |
| 373 | string buf; |
| 374 | if (get_string(buf) == 0) |
| 375 | return -1; |
| 376 | return atof(buf.c_str()); |
| 377 | } |
| 378 | |
| 379 | const std::vector<geo_member>& redis_geo::georadius(const char* key, |
| 380 | double longitude, double latitude, double radius, |