1

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.

2
  • 1
    recommended reading: Gorilla vs Shark -- "if you... don’t want your question to get instantly closed... — try to keep Gorilla vs. Shark in mind."
    – gnat
    Jan 14, 2015 at 15:57
  • 2
    If you are currently using a database, I'd say use whatever database you are using now so you don't have to maintain 2. Jan 14, 2015 at 16:08

1 Answer 1

2

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.