Page 1 of 1
Clear cache by visiting a hidden page?
Posted: Thu Apr 09, 2015 12:02 am
by paulbaker
Is there a way of running the clear cache command (with a UDT?) without going through the admin area?
I mean so that I can visit a page (not in menu) like domain.com/clearcache.php which would include a call to a UDT which would then clear the cache when visited.
(Background: I had a call from a client who had lost their menu, a clear cache sorted it but in future it would be great to be able to just visit a URL rather than logging in to admin area (which I had to do in the car park of a theme park!))
Thanks
Re: Clear cache by visiting a hidden page?
Posted: Fri Apr 10, 2015 5:58 am
by Rolf
Do you have the daily clear cache setting enabled in Global Settings? It might be a better solution.
Grtz. Rolf
Re: Clear cache by visiting a hidden page?
Posted: Fri Apr 10, 2015 4:22 pm
by calguy1000
Clearing the cache should NEVER be done via a frontend request. As you never know exactly what files are needed for that request.
If your system requires you to clear the cache periodically because stuff breaks then: There is something going on that you have not dug hard enough to find. It may be as simple as a disk space or quota issue. But clearing cached files without really knowing the problem you are solving is a bad idea.
As @rolf mentioned, there is a setting in the global settings dialog that will ensure that old cached files are regularly deleted. Be sure you have set it up, I usually configure it to delete cached files older than 15 or 30 days. depending upon the site.
No modules that fool en-masse with the cache will be allowed in the forge. This is because such a module would be breaking the forge rules about module A altering module B's (or the core's data). Additionally, the API function to clear the cache is marked as internal, and undocumented. Modules using internal/undocumented functions or manually deleting files from the cache directory will be removed from the forge.
In the past such problems that were <cough>fixed</cough> by clearing the cache were caused by silly system problems:
a: Time sync problems between the php server, file server, and database server.
b: Silly problems like out of disk space/disk quota.
etc.
Re: Clear cache by visiting a hidden page?
Posted: Sat Apr 11, 2015 9:30 pm
by paulbaker
Thanks Rolf and Calguy, I see in Global Settings I can "Remove cache files that are older than the specified number of days". That's useful and I can set it for 1 day but doesn't help if the error occurs just after the daily clear out has occurred.
calguy1000 wrote:If your system requires you to clear the cache periodically because stuff breaks then: There is something going on that you have not dug hard enough to find.
Yes, I certainly take your point there!
Thanks