How do websites like YouTube track their video's video count?
For instance, YouTube only refreshes the video views every several hours, but it obviously still runs an update query on every page load.

I would like to have a "top 10 items of the day" list, as well as top 10 this week and top 10 this month - but how do I do this efficiently?