WordPress Plugin: Keep Your Cache Up-to-Date

Here’s a plugin that will automatically repopulate your LiteSpeed Cache when an article gets updated on WordPress — enjoy LSCache speed and article updates without waiting for cache to expire.

To install the plugin, just download lscache-purge plugin and add to WP plugins (Plugins => Add New => Upload).

wp_upload

Or, install directly using the Search tab and the plugin URL (http://www.litespeedtech.com/packages/wp-plugins/lscache-purge.zip).

wp_install

Once installed, go to Installed Plugins and activate it.

wp_activate

The plugin comes with GUI under Settings for choosing the purge cache method — purge or refresh.

wp_settings

wp_settings_choose

For details on refreshing the cache, refer to this blog entry.

Next, enable LiteSpeed Cache, if you have not done so.

WebAdmin console => Configuration => Server => Cache

Cache Storage Settings
Storage Path: /disk/lscache
Max Object Size: 128000

Cache Policy
Enable Cache: Yes
Cache Expire Time (seconds): 120
Cache Stale Age (seconds): Not Set
Cache Request with Query String: No
Cache Request with Cookie: Yes
Cache Response with Cookie: Yes
Ignore Request Cache-Control: Yes
Ignore Response Cache-Control: Yes
Enable Private Cache: Not Set
Private Cache Expire Time (seconds): Not Set

Do-Not-Cache URL
wp-admin

Here’s a screenshot of the cache setup:

LSCacheSetup

For more details on how to set up LiteSpeed Cache, refer to our wiki.

Note the “Do-Not-Cache URL” box. It specifies URL patterns not to be cached. In this case, URLs that start with “/wp-admin” are excluded from being cached.

That’s it. LSCache will take care of the rest. Have fun!

Screen Shot 2013-02-19 at 10.35.36 AMStormtrooper photo courtesy of Flickr user JD Hancock, licensed via Creative Commons.

 

Tags: , , , ,

12 Responses to “WordPress Plugin: Keep Your Cache Up-to-Date”

  1. tyler says:

    1. Why do we not want to set a stale age?
    2. how will other plugins be effected that cache? quick cache, total cache….

  2. Tony says:

    Stale age is 10 seconds by default if Not Set.

    Other plugins will not be affected by LS cache (page cache).

  3. tyler says:

    Getting this error:

    The plugin generated 1 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

    http://wordpress.org/extend/plugins/lscache-purge/

    Also, can the purge be improved so more changes will clear cache? Such as menu change?
    Also, what is a typical setting for how long to keep cache?

  4. Tony says:

    The message was due to an extra space after closing tag in the plugin file. You can edit the local copy or do fresh re-install.

    < ?php
    ...
    ?>


    if time is allowed, we can improve the plugin. will let you know.

    you can keep cache as long as you want if your cache storage has enough space. You can set to 1 day to start with.

  5. tyler says:

    is the plugin file updated on WP to a new version (so it will auto update?)

  6. Tony says:

    It has been updated to a new version and will auto update.

  7. Richard says:

    As most people who use this plugin won’t have access to litespeed’s settings, would it be possible for this plugin to add a few lines to the .htaccess file so it can run on servers with cache turned off by default ?

    Thanks

  8. RK says:

    The cache policy recommended here differs from the cache policy recommended in the LS Wiki.
    http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:litespeed:cache:wordpress

    My specific concern is the “Cache Request with Cookie:”

    I have a site on which form data was not cleared between users after enabling cache request with cookie. Coincidence?

    • Tony says:

      The policy listed is just an example how the cache can be setup. it is up to host/user to adjust for their application. In your case, yes, turn it off.

  9. Adrian says:

    Hi Litespeedtech,

    Do the LiteSpeed Cache WordPress plugin work perfect with Woocommerce Plugin (shopping cart plugin)?

    Woocommerce having some pages that can’t be cache like the cart page, checkout page etc…

    I didn’t see the plugin give us the option to exclude some pages.

    For Varnish, we need to set some exclusion rules. Here is the documentation:
    http://docs.woothemes.com/document/configuring-caching-plugins/

    Can i know what we have to do if we want to use litespeed cache?

    Thanks

    • Michael says:

      Hi Adrian,

      You can tell LSCache not to cache certain URLs by using rewrite rules. The guide is in our wiki:

      RewriteCond %{REQUEST_URI} !/(login|register|usercp|private|profile|cron|image)\.php$


      Michael