I'm writing a web app that is basically facebook events, but more impromptu and real time. A user can create an event, and other online users in the area (30 mile radius) should immediately see the event. Users can sign up for events, and the host should see the invites. The host can cancel the event, and all participants should receive notice. No long polling or refreshing is needed, and i'll most likely be using websockets (socket.io)This concept is simple to describe, but i've gotten a headache just thinking how exactly this can be implemented. Especially if a user has multiple sessions.. Redis has captured my attention recently. Can i receive suggestions on my implementation plan, to make sure i'm not going down some crazy path?I keep track of logged in users locations in Redis.User creates event and I store it in Redis.I find all users that are in the 30 mile radius of event, and notify them thru socket.ioThe host and users who sign up for event are entered into Redis pub/sub for any kind of notifications.Once event is over, i remove event from Redis and store in MySQLIs my implementation doable? Does it make sense to use Redis here?
Is my use case for Redis appropriate?
design;redis
Cache can be used and will help here as many clients for events which will rarely change. Even if they change:updating a key, or deleting and adding it back lazily, works fine.For exactly how you should do it - experiment. Plunge in with the only caveat : you will learn and change. Embrace that idea and run with it. I have seen code that stores same event (not of fb but other domain's) twice - in a list and with a different key for single events... just saying depends on your use case and how much memory you have.I would not worry about memory now. Just solve your problems and write jmeter type tests to see how well its working.Later you can optomize and/or get more server space.