Redis 3.2 added geospatial commands

Finding the nearest branch used to mean a bounding-box query in SQL with a Haversine formula in the ORDER BY, which cannot use an index and gets slower with every row. Redis 3.2 stores coordinates in a sorted set and queries them by radius.

GEOADD branches 27.1428 38.4237 "izmir-centre"
GEOADD branches 28.9784 41.0082 "istanbul-centre"

GEORADIUS branches 28.90 41.00 50 km WITHDIST ASC
1) 1) "istanbul-centre"
   2) "6.8241"

The implementation is a geohash packed into a sorted set score, so every existing sorted-set command still works on the key — which is occasionally useful and mostly a curiosity. It is the right tool when the set is small enough to hold in memory and changes rarely, such as branches or pickup points; a full geospatial workload still wants PostGIS or Elasticsearch.