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!
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!