2017 © Pedro Peláez
 

craft-plugin lite-speed-cache

Clear the LiteSpeed cache on page save.

image

thoughtfulweb/lite-speed-cache

Clear the LiteSpeed cache on page save.

  • Thursday, May 10, 2018
  • by thoughtfulweb.com
  • Repository
  • 2 Watchers
  • 4 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 25 % Grown

The README.md

CraftCMS LSCache Purge

Destroy LSCache on save, or force destroy., (*1)

Installation

  1. Move the litespeedcache folder into your craft/plugins directory
  2. Install the plugin in the Control Panel
  3. Set your LS Cache folder path on the settings page, you may need to ask your host where this is
  4. Turn on Clear caches per URL? if you need it on the settings page

Markup

Cache records need to have the path set as the key., (*2)

{% cache globally using key craft.request.path %}
{% cache globally using key craft.request.path ~ '/p' ~ craft.request.getPageNum %}

If you need to add extra data to the key (e.g if you're using a different limit parameter for different browser sizes) then you must seperate this information from the path using %%, (*3)

{% set cacheKeyType = craft.request.isMobileBrowser() ? 'mobile' : 'desktop' %}
{% cache globally using key craft.request.path ~ '/p' ~ craft.request.getPageNum ~ '%%' ~ cacheKeyType %}

For any parameters that are truly global parameters, like navigation, prefix the key with global%%. This will trigger a global purge instead of purging per URL, as every page will need to be refreshed for navigation changes to take effect., (*4)

{% cache globally using key 'global%%navigation' %}

On your default document, you must add a header to tell LSCache to not cache the entry if it cannot find a cache record in craft_templatecaches table. If there is no cache record associated with the entry, pressing save will not fire a purge request to the URL., (*5)

{% if not craft.liteSpeedCache.checkTemplateCache(craft.request.path)|length %}
    {% header "X-LiteSpeed-Cache-Control: no-cache" %}
{% endif %}

Notes

We'd recommend setting globally to reduce the amount of cache records that you get, otherwise you'll end up with hunderds of cache records if there are URL paramaters defined for a page., (*6)

This plugin does run the LSCache clearances as a batched task, so hopefully it shouldn't be too intensive on the server. If you're noticing massive latency issues, it might be worth selecting the global purging option., (*7)

If you're running CraftCommerce, the plugin will globally purge for now., (*8)

You cannot use CloudFlare and still use per-URL purging. Either do not route through CloudFlare, or just enable the global purge., (*9)

The Versions

10/05 2018

3.0.0.x-dev

3.0.0.9999999-dev

Clear the LiteSpeed cache on page save.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft litespeed cache

10/05 2018

1.2.1

1.2.1.0

Clear the LiteSpeed cache on page save.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft litespeed cache

10/05 2018

1.2.0

1.2.0.0

Clear the LiteSpeed cache on page save.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft litespeed cache

10/05 2018

1.1.7

1.1.7.0

Clear the LiteSpeed cache on page save.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft litespeed cache

09/05 2018

1.1.6

1.1.6.0

Clear the LiteSpeed cache on page save.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft litespeed cache

02/05 2018

1.1.5

1.1.5.0

Clear the LiteSpeed cache on page save.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft litespeed cache

02/05 2018

1.1.4

1.1.4.0

Clear the LiteSpeed cache on page save.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft litespeed cache

02/05 2018

1.1.3

1.1.3.0

Clear the LiteSpeed cache on page save.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft litespeed cache

12/04 2018

1.1.2

1.1.2.0

Clear the LiteSpeed cache on page save.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft litespeed cache

12/04 2018

1.1.0

1.1.0.0

Clear the LiteSpeed cache on page save.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft litespeed cache

06/04 2018

1.0.2

1.0.2.0

Clear the LiteSpeed cache on page save.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft litespeed cache