i have a problem and confused a little bit. I made some research in stackoverflow but cannot reach the exact solution.
My problem is that : I retrieve some datas from Google Analytics but this method is too slow.What i want to do is that i want to retrieve datas from Google each 6 hours and inserting them into DB then users can have datas on my site faster because i will take datas from DB.
In my research, i find some solutions like cron and memcached, but is there any way to do in php with some functions?
In phpp manual, i recognize some function like time() . Can i do that with time() function ?
You can solve it in this way. You store data from google in your DB, but adds one more field – like
last_update_timeand put there the time you have got it from google. When next time user is getting data from your DB, you need to check the difference betweenlast_update_timeand current time. Then if it is bigger than 6 hour, so you grab new data from google and refresh it in you DB, as thelast_update_time.This will allow you not to use cron.