Can someone tell me the correct way to setup the 'Server Cache Settings' function in 'Global Settings' so that my tmp/cache folder is automatically cleared every day. I have set 'Remove cache files that are older than the specified number of days:' to '1' but this doesn't seem to be having any affect?
Is the 'Server Cache Settings' function supposed to be able to empty the tmp/cache folder?
Thanks
Setup 'Server Cache Settings'
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Setup 'Server Cache Settings'
The server cache settings thing is just a setting used by the cach cleaning pseudocron thing that clears files older than N days. IIRC this task runs once per day.
[edit]No more than once per day[/edit] (depending upon incoming requests) it will find files in the tmp/cache (and tmp/templates_c) directories that are older than N days, so with the pseudocron stuff, and regular incoming requests to your website it is possible for files to exist in the tmp/cache directory for ~47 hours.
I suspect if your having problems with cached files that you have more serious issues with the time on your server. I once debugged 'caching issues' on a server and it was due to the fact that the file system that CMSMS was using was a remote/networked file system and that remote server hosting the files had a different time setting than the http/php server.
Try running a UDT like this one.
$fn = TMP_CACHE_LOCATION.'/datetest.x';
touch($fn);
$mtime = filemtime($fn);
if( abs($mtime - time()) > 3 ) die('uh-oh, server problem');
[edit]
One module developer (who shall remain nameless) even attempted to work around a problem similar to this by writing a module that would 'clear the cache' after each request. Rather than contact the host to actually resolve the problem correctly.
[/edit]
[edit]No more than once per day[/edit] (depending upon incoming requests) it will find files in the tmp/cache (and tmp/templates_c) directories that are older than N days, so with the pseudocron stuff, and regular incoming requests to your website it is possible for files to exist in the tmp/cache directory for ~47 hours.
I suspect if your having problems with cached files that you have more serious issues with the time on your server. I once debugged 'caching issues' on a server and it was due to the fact that the file system that CMSMS was using was a remote/networked file system and that remote server hosting the files had a different time setting than the http/php server.
Try running a UDT like this one.
$fn = TMP_CACHE_LOCATION.'/datetest.x';
touch($fn);
$mtime = filemtime($fn);
if( abs($mtime - time()) > 3 ) die('uh-oh, server problem');
[edit]
One module developer (who shall remain nameless) even attempted to work around a problem similar to this by writing a module that would 'clear the cache' after each request. Rather than contact the host to actually resolve the problem correctly.
[/edit]
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Setup 'Server Cache Settings'
Thanks for the detailed reply Calguy. That makes much more sense now. I do have files older than '1 day' but none older than 47 hours so that is the only issue as oppose to any problems with the server.