GAE datastore design to store “like” mechanism for user's status (like Facebook's “likes”)

雨燕双飞 提交于 2019-12-12 03:26:03

问题


I'm using Google App Engine's datastore and looking for a design solution for "like" functionality for user's status (similair to Facebook "likes")

I've gone through the Sharding Counters concepts (https://developers.google.com/appengine/articles/sharding_counters) and found its good and suitable for counting number of likes where you can increment or decrement the count. But I want to store the userId who liked the status. So I tried the same sharding concepts to store userIds but facing the below issues, * First of all is it good to shard userId list like count? * If so when the user dislike it, I have remove the user id from shared list. To achieve this I need to traverse all the sharded datastore and do a userId check and remove

Any suggestions on this or alternative solutions to achieve it?


回答1:


Sharding doesnt apply for that case. Sharding is to avoid many writes to the same object in short time periods. Makes sense for a 'likes' counter since many people like the same post. Not the same when sgoring who liked what. Those objects only change per-user, many users dont share the same object. Just store those in a non sharded table like you would in sql.



来源:https://stackoverflow.com/questions/19319617/gae-datastore-design-to-store-like-mechanism-for-users-status-like-facebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!