Hello. I am creating a site that is completely dependent on user generated content. Users submit stories which other users can rate and comment. I won't go into full details but that is main premise. Of course there is "originality & hook" factor too but I'm not comfortable to share it. There are no friends or themes/nodes/groups. Everything is public and everyone can read, comment and rate. What is the approach for creating ranking system for popularity? I want to have some sort of "Trending" page where all of interesting stories will be listed. I never done things like that before so I need some guidance from folks who did it. First idea is to create cron job that will trigger the script that analyze recent stories and their activity. Each story will get their popularity rating based on users rating, comments, views etc. Key thing is formula which is time dependent function.
So, are there other approaches for this kind of thing?
Also, since this is time dependent function how do you test its accuracy or efficiency?
Jeremy Bloomstrom
Programmer Analyst
I would look at using an in-memory cache (e.g. Redis) to store stats about the content (views, likes, shares, etc.). You can persist the cache data to your db on a set interval (daily or hourly if you like). You could then start analyzing trends (e.g. hot this week, this month, all time, etc.). Laracasts.com has several great videos explaining how to use Redis for this exact use case. https://laracasts.com/index/redis Best of luck!