I'm building social media platform where users can...
# random
r
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.
n
I think for HN the way it works is you have upvotes buoying posts up, and the age of the post exponentially pushing posts down, so as time goes on the number of point required to stay on top increases exponentially
then maybe you can recompute the effective score every minute for every post in the last 24h, plus posts currently in the top 100