WordPress.org

Support

Support » Plugins and Hacks » Manually delete the cache

Manually delete the cache

  • I have over 18.000 posts, so clearing the cache via the options page is a hassle, constant 500 errors until everything is deleted. Don’t get me wrong, it works, but I was wondering if I could just as well clear it via SSH?

    Would this command work? Or will wp-super-cache complain / run into problems if I don’t use it’s own php functions to clear all files?

    find /www/wp-content/cache/ \( -name '*.html' -or -name '*.html.gz' \) -delete

    (The command deletes all .html and .html.gz files)

    http://wordpress.org/extend/plugins/wp-super-cache/

Viewing 4 replies - 1 through 4 (of 4 total)
  • After trying it a few times I can’t find any errors popping up. I added *.meta files to be deleted as well.
    Here’s my final ssh command:
    ssh user@host "find /www/wp-content/cache/ \( -name '*.html' -or -name '*.html.gz' -or -name '*.meta' \) -delete"

    For anyone that reads this I switched to an even better solution: moving the cache folder first, then deleting it. Should save you from any PHP collisions.

    cd www/wordpress/wp-content
    # example folder
    mv ./cache ./cache_old && mkdir -p ./cache
    # move cache and if moved make new dir
    if [ -d ./cache_old ] && [[ "$PWD" =~ www/wordpress/wp-content ]]; then
      # if previous cmd was a success and
      # we're in the right folder
      rm -rf -- cache_old
      # the -- is a safeguard thing when using rm -rf
    fi

    Could there be a much easier solution for a non technical people. I offer Forex Signals on website which are sent in real time. I noticed that after installed plugin I need to manually clear cache every time I post a signals. Sometimes even after clearing cache it takes 10-15 mins before signals are delivered.

    Since the nature of business is time sensitive I’d to uninstall the plugin in order to deliver content in real-time.

    Could there be a much easier solution for a non technical people.

    wp-super-cache does try and offer options that lets you delete the cache whenever you make new post, a comment is made, or both. Check Settings -> WP-Super-Cache -> Advanced.

    Or you could expand when it deleted the cache using add_action, check out this forum-thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Manually delete the cache’ is closed to new replies.