Using Redis to store temporary object GPS positions
We are going to use Redis to store our GPS coordinates for all detected objects using computer vision. This is a basic configuration to deploy Redis for this purpose. This Redis instance must be deployed in the cloud. As we explained in Chapter 13, Geolocalization Applications Using GPS, NoSQL, and K3s Clusters, we are going to use a geospatial index to represent our data. The difference will be that we are going to implement temporary storage of data using a time-to-live (TTL) feature that auto-expires keys in Redis. For this, we are going to continuously watch hash keys in Redis if they still exist. For each detected object, the type and level of warning are stored in a hash key, and a coordinate will be added in a geospatial sorted set. Then, a TTL is configured for the hash key. If this hash key expires, it will be removed from a geospatial set called traffic
, which stores all traffic objects detected by other drivers. In this...