dimanche 6 juillet 2014

Structuring redis keys


Vote count:

0




I've never used redis before, but I've been meaning to, and it seems that my current use case is an appropriate fit.


I'm essentially trying to build a messaging app. When one user sends another a message, the data sent to the server looks like this:



{ from_user: 'alice', for_user: 'bob', payload: 'hello!', timestamp: 1404695488 }


What I would then like to be able to do is:




  1. Given alice, see all users that have sent alice a message that alice has not yet read




  2. Given alice and bob, return a list of all messages bob has sent alice, from which I can pop what alice has read. Once alice has read all the messages bob has sent her, then #1 won't return bob.




If I haven't clarified enough, please let me know. Additionally, another part of the reason that I've chosen redis is that since this is a messaging app, I'd like to make use of the Pub/Sub features.



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire