I'm trying to create something similar to the stackoverflow "user score" on my site with a mysql. I don't want to be calculating this score every time a user is accessed because multiple user scores will be displayed at the same time and the way it's calculated doesn't require it to be updated frequently. My thoughts are to update all of the score rows in the user table on a timed basis (hourly, daily, etc.) Here is what it would look like:
user.score = user.score + x_actions_since_last_update *2 + y_actions_since_last_update - z_actions_since_last_update*3
But how do I go about running this at a timed interval? Is this even the best method to get done what I'm trying to do? Is there some sort of caching I should do instead? Thank you!