Google App Engine - How do I handle sending alerts to a user?
I have a facebook style app, and I need to be able to send my users messages that get displayed on the page, like "Someone commented on your picture".
Currently the way I am doing this is having the user do a datastore request for an object that contains possible messages every single time they make a request. A task updates the object for the user w开发者_开发知识库hen a message needs sent.
Is there a better way I can do this? I know I could probably find some speed up by using the memcache somehow, but is there any better way? Like writing directly into their session from the task somehow?
The approach you're taking is reasonable. You could update the session directly, but that assumes the user has only one session, and the improvement is small. As long as you're using a batch get rather than a query to retrieve notifications, and memcaching wherever possible, this approach should work fine.
精彩评论