Jump to content

How often does my script create a cache?


JohnnyDoomo

Recommended Posts

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.