Clearing Joomla cache in auto mode using Cron job
Enabling cache feature in your Joomla site means a necessity to clean Joomla cache time to time to avoid increasing website size. You can do it manually via Control panel. But how to purge cache folder automatically? It’s easy with Cron job.
The size of cache folder of your Joomla site reduces with time if standard cache is enabled and it makes website size bigger and bigger with time, especially if you don’t have time to support website on regular basis and of course it’s good to use such solution which will do it automatically. The most simple way is to use Cron job which works on back-end side and do not affect front-end side of a website while proceeding.
You can log in on hosting panel and go to Cron job manager. Now you must create the next cron task:
rm -f /[full_path]/yoursite.com/cache/* >/dev/null 2>&1
Please take a look you must enter absolute URL path. Example:
rm -f /var/www/myweb/root/yoursite.com/cache/* >/dev/null 2>&1
You can get full URL path using php.ini or take it from configuration.php of your Joomla website.
It’s recommended to run cron task once per a day and preferable at night time (to minimize server load), optimal time is 4:30. Also take a look some extensions can store cache files in /media/ subfolders.
Eugene has been a part of and worked in many of the web development roles over the years, taking on various projects. At the present moment, he is involved as a team manager working inside his personal projects. This blog is specifically dedicated to start-up businesses, team management, and how to maximize your success with Open Source ideology.