I'm building social media platform where users can like and comment on post. I want to implement rising posts features. For example, when more and more users like and comment a post, it should be visible to users as in top posts section. What should be pseudo code or architecture for it?
Here's what I thought:
• Maintain a redis list (or set) for top 10 posts
• On every like and comment, calculate score counted by total likes and comments Compare score in redis list elements.
• If it's more than any element, push current post to that index.
Any other approach is also appreciated.