MCPcopy Create free account
hub / github.com/acl-dev/acl / geodist

Method geodist

lib_acl_cpp/src/redis/redis_geo.cpp:354–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354double 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
379const std::vector<geo_member>& redis_geo::georadius(const char* key,
380 double longitude, double latitude, double radius,

Callers 1

test_geodistFunction · 0.80

Calls 3

hash_slotFunction · 0.85
buildFunction · 0.50
c_strMethod · 0.45

Tested by 1

test_geodistFunction · 0.64