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.

closed as off-topic by user53019, user40980, Kilian Foth, MetaFight, Tulains Córdova Jan 27 '15 at 9:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Community, Community, Kilian Foth
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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 '15 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. – GrandmasterB Jan 14 '15 at 16:08

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.