Redis implementation
Redis implementation
Requirements
Current location of an object (drivers in case of Uber, delivery agent’s location in case of a food delivery app).
Mapping from a Geo-Hash prefix to the objects
Proper expiry of the dynamic location data since in this use case, we are dealing with dynamic objects.
Redis SortedSet
For requirements 2 & 3 above, we can implement Redis sorted set (priority queue). The key of the sorted set will be the Geo-Hash prefix of length L. The member is objects’s id which are currently sharing the Geo-Hash prefix (basically they are withing the region represented by the Geo-Hash). And the score is current timestamp, we use the score to delete older data.
Last updated