Grokking Redis
0% completed
8.8 Design Uber Driver Matching
One command finds the nearest available drivers to a rider standing at a pickup point in Lahore:
redis> GEOSEARCH drivers:{lahore}:economy FROMLONLAT 74.357 31.520 BYRADIUS 3 km ASC COUNT 3 WITHDIST 1) 1) "d123" 2) "0.5053" 2) 1) "d871" 2) "0.8285" 3) 1) "d046" 2) "1.3709"
Each result is a driver ID and its distance in kilometers from the pickup point, nearest first. The command itself is the easy part. The hard part is that the data behind it moves constantly, goes out of date within seconds, and must be searched in tens of milliseconds
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%