Question

I have to save some data about users with their location. This data will only be valid for like 5-10 minutes, then it will never be used again.

So I am having a simple data structure like:

{
    user_id: 4434993283283,
    major: 5,
    minor: 33
}

major and minor are used to track the position of the user. It is possible that the minor value is sometimes not available and therefore null. When I get the data. I want to get a list of users filtered by the major and, if available, the minor value.

So now my question is "What's the best way to store and retrieve this kind of data?"

I have considered using a redis database where I make keys with a expiration time or a postgres database with a timestamp, but I am open to other suggestions.

Was it helpful?

Solution

If it only has a lifetime of 5 to 10 minutes, and there isn't a whole lot of it, then store it in memory.

If those things are not true, any key/value store or relational database will do.

Licensed under: CC-BY-SA with attribution
scroll top