JohnnyDoomo Posted April 17, 2014 Share Posted April 17, 2014 I'm a noob at php, but I've found this line: $cache_time = (60*60) * 1; To my understanding, this means that the script is caching once every hour. Is this correct? I have verified that the files within the cache folder are being created upon first visiting the pages. The problem I'm trying to solve is to prevent that first time visit creating the cache, which takes quite a long time to load. I did some googling and found that if I add this line to my cron wget -O - http://website.com/page-that-forces-cache-creation >/dev/null 2>&1 that it's suppose to work. I set that above cron command to run every hour on my server, but pages still load slow, and I can tell that they are creating the cache upon my actual visit to them. The above cron command I got from a stackoverflow post, and I'm fairly certain I have set it up correctly in my cpanel. Is there something I am doing wrong, from the info I've given? If both are correct, I can't see why the script is still manually creating the cache, when the cronjob should be forcing it to do it every hour. Any help, or pointers you can give me would be appreciated. Thanks. Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 17, 2014 Share Posted April 17, 2014 a) is your cron job running? b) you would need to debug why your cron job isn't updating/creating the cached files. c) what is your page/site doing that is taking a long time, as threads like this generally need to start by fixing whatever problem is causing the long page generation time, rather than to apply a band-aid over the top of the problem. Quote Link to comment Share on other sites More sharing options...
JohnnyDoomo Posted April 19, 2014 Author Share Posted April 19, 2014 Is there a way to test and see if my cronjob is working? Like a command that will create a file or something so that I can see if it is auto created / updated by the cronjob? The job of the cron is being used to force my site to check for updated rss feeds at regular intervals, so the cronjob is more a function of what needs to be done, and not so much a band-aid. It will simply prevent the site trying to load the RSS feeds upon a user requesting the page, and instead have them ready, inside of cached files on my server already. Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 20, 2014 Share Posted April 20, 2014 to check if code in any file is running, you can add code to it to append a line with the date/time to a log file - file_put_contents('log.txt',date('Y-m-d H:i:s')."\r\n",FILE_APPEND); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.