Page 1 of 1
Setup 'Server Cache Settings'
Posted: Tue May 07, 2013 10:50 pm
by clj83
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
Re: Setup 'Server Cache Settings'
Posted: Wed May 08, 2013 12:36 am
by calguy1000
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]
Re: Setup 'Server Cache Settings'
Posted: Fri May 10, 2013 10:32 pm
by clj83
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.