WP Super Cache is an excellent caching plugin, but sometimes it seems to have problems with deleting expired files. For example, even though this site typically gets at least 3000 pageviews per day, and I’ve set WP Super Cache to delete expired files every 1000 requests (the lowest setting), the expired files tend to accumulate. Also, for lower-traffic sites it could take more than a day to get at least 1000 pageviews, and the cache might get stale.
Enter the “WP Super Cache Cleaner” – a simple WordPress plugin that will periodically delete expired super-cache files regardless of whether your blog has reached the “X requests” threshold. You can set it to run either daily or hourly (the default is daily). The plugin will then use the built-in WordPress scheduler to automatically clean the cache that often.
Note that in the current implementation only expired “super-cached” files will be deleted – WP-Cache files won’t be affected.
cache-cleaner.zip (2 KB)
Compatibility : Tested with WordPress 2.6.2 – 2.7 and WP Super Cache 0.8.1 – 0.8.3.
Installation : Upload, activate, go to Settings -> Cache Cleaner to configure.
For increased reliability, set up a cronjob to run wp-cron.php at the same frequency as you used for this plugin. For example, if your blog is found at “http://example.com/” and your control panel is cPanel, you can set up a cronjob like this :
- Log into cPanel and click on “Cron jobs”. Select the “Standard” interface.
- Select “Every Month”, “Every Week Day” and “Every Day” from the appropriate lists.
- If you set the plugin to run every hour, select “Every Hour” from the “Hour(s)” box. Otherwise, select any other setting from that list.
- Select any number from the “Minute(s)” list.
- Enter this command as “Command to run” :
wget -q -O /dev/null http://example.com/wp-cron.php
- Save Crontab.
Note that setting a specific time for the cronjob – e.g. “09:24” – will not make the plugin delete expired files at exactly that time, except perhaps by a lucky coincidence. This is not a bug.Related posts :