Google AppEngine authentication
I'm developing a Google AppEngine application and trying to figure out what is the best way to check whether an user is authenticated. I use standard authentication mechanism provided by AppEngine, but in the context of my app the user is authenticated only if he/she is already registered within the app. So I need to check if there is 开发者_运维问答a record in the datastore for the user for every request. But I'm a bit concerned about performance.
Is there a better way to deal with this problem? I know it could be improved keeping user records in memcache. But I wonder if there is a better approach?
There's no magic bullet solution like you seem to be wanting. You'll need to do a datastore get on every request (a get, not a query, if you store your user data record with the key name equal to the user's user_id
). You can use memcache, as you suggest, to reduce the cost of this by storing the user's record there in addition to the datastore.
精彩评论