invitation chains
The site what.cd
uses a type of invitation chain whereby if I invite a friend to the service and they break the rules and loose their account I also开发者_运维知识库 loose my account as does the person who invited me and so on.
What is the best way to keep track of this kind of invitation inheritance, Just a table cell linking the user to the user who invited them via their ID or something similar?
If you retain the "inviter" information only on the "invited" model, you have essentially created a singly linked list.
http://en.wikipedia.org/wiki/Linked_list
For the described purpose, the features of such a data structure work reasonably well.
If you think you'll ever need to look at all the people that a person has invited, you may want to keep track of both pieces of information for easier lookup. Alternatively, you could build a table of "invites" that is indexed by both inviter and invitee, which would allow pretty flexible querying.
精彩评论