Cache Cleaner For WP Super Cache

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.

Download

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.

Extra Tip

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 :

  1. Log into cPanel and click on “Cron jobs”. Select the “Standard” interface.
  2. Select “Every Month”, “Every Week Day” and “Every Day” from the appropriate lists.
  3. 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.
  4. Select any number from the “Minute(s)” list.
  5. Enter this command as “Command to run” :
    wget -q -O /dev/null http://example.com/wp-cron.php
  6. 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 :

13 Responses to “Cache Cleaner For WP Super Cache”

  1. Interesting plugin, but I’ve just tagged a new release of WP Super Cache that does something similar. I’ve had it running on my own blog for the last two weeks and it works fairly well. It deletes expired files at predetermined intervals, the default being an hour.

    Hope that works better than the “every X hits” method.

  2. White Shadow says:

    Gah, I guess I need to start coding only things that are completely unique, instead of improvements/hacks for existing systems. They just don’t have staying value.

    Edit: The problem is unique ideas are hard to come by or bloody hard to implement.

  3. You’re on the right track though, “Scratch an itch”. Whatever you find useful, others will too.

    Anyway, watch my blog, I’ll be posting about the new release shortly :)

  4. Qbrushes says:

    Hi, I’m having issues with my wp-super-cahche and was thinking to try your solution, dose it work with 0.9.1?

    Thanks

  5. White Shadow says:

    No idea, I haven’t tested it with the newer versions because WP Super Cache now includes a similar cache cleaning function.

  6. Eduardo says:

    Simply perfect. the Super-Cache´w cleaning funtction did not worked fine in my web site, but this plug-ing helpped me to work fine. Thank you so much.

  7. […] revealed some change was recently made to garbage collection timing. Someone suggested I try the WP Super Cache Cleaner WordPress plugin that will periodically delete expired super-cache files regardless of whether your […]

  8. Andrei says:

    Hi!
    This function is not works for me and is not cleaning the cache: “The plugin will force WP Super Cache to delete expired cache files at least this often, regardless of whether the number of requests set in Garbage Collection is reached or not. ”
    Is saying: “You do not have sufficient permissions to access this page.”
    I have to change some security php level? (some scripts I can install on the server, some not)
    Thank you in advance
    Andrei

  9. White Shadow says:

    The plugin has been made mostly redundant by the cache cleaning improvements in the newest versions of WP Super Cache. Chances are you don’t really need it.

  10. Thanks for posting this informative post. Never knew that opinions could be this varied. Keep up the good work, Alexander Wright ~ Flyttstädning

  11. […] ø Cache Cleaner For WP Super Cache | W-Shadow.com ø (etiketler: plugin cache wordpress wp_plugins wp wordpress-glugin) […]

  12. amar says:

    does this increases site’s speed?\
    thankss

  13. No, it probably won’t have any appreciable effect on site speed.

Leave a Reply