Showing statistics that refresh every 10 minutes

Associate
Joined
18 Nov 2008
Posts
2,430
Location
Liverpool
I'm sure you've all seen all the websites that have a stats page, and underneath they say "These stats refresh every 10 minutes".

Now I know why this is done - presumably to save such big querys being executed every time someone hits refresh - but my question is, how is it done?

Is it:
A: A timer is ran and every 10 minutes a function is ran to obtain the statistics and put them into a table which the site then reads from.

B: The last refresh time is stored, and when a user refreshes, if the data is more than 10 minutes old, it re-runs the query and then saves the data into the database, removing the need for a timer

C: Something else?

Hope this makes sense, thanks!

EDIT: P.S. Language is PHP!
 
Back
Top Bottom