Redis GEO

Redis GEO is a set of geospatial commands that stores named members with longitude and latitude coordinates. Redis internally represents GEO data using a sorted set with geohash-based scores, allowing applications to update positions and perform geographic searches.

Minimal example

go
location := &redis.GeoLocation{
    Name: "rider:101",
    Longitude: 77.5946,
    Latitude: 12.9716,
}
err := rdb.GeoAdd(ctx, "riders:geo", location).Err()
if err != nil {
    return err
}

Learn this concept

Lesson 5.6 · Redis GEO and SET NX PX

Used in exercises

Exercise 5.7 · Rider presence service Exercise 5.8 · Rider assignment worker
Prerequisite conceptsRedis TTL