2017 © Pedro Peláez
 

craft-plugin upper

A cache plugin for Craft - supporting multiple Edge Caches

image

ostark/upper

A cache plugin for Craft - supporting multiple Edge Caches

  • Tuesday, July 10, 2018
  • by ostark
  • Repository
  • 1 Watchers
  • 59 Stars
  • 1,269 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 5 Open issues
  • 16 Versions
  • 63 % Grown

The README.md

, (*1)

The pep pill for your Craft site

Latest Stable Version Total Downloads Monthly Downloads, (*2)

Upper speeds up Craft dramatically using a Cache Proxy in front of your webserver., (*3)

The Plugin adds the neccessary Cache-Control and XKEY/Surrogate-Key/Cache-Tag headers to your pages. When Entries or Sections get updated in the Control Panel it takes care of the cache invalidation., (*4)

If you need an introduction to HTTP Caching, I highly recommend this article., (*5)

Development happens in my free time, but also during working hours. Thanks fortrabbit.com!, (*6)

If you are looking additional integrations (Cache Drivers), feel free to contribute or raise an issue., (*7)

Supported Cache Drivers

  • KeyCDN (CDN/SaaS)
  • Fastly (CDN/SaaS)
  • Cloudflare (CDN/SaaS)
  • Varnish with XKEY support (your own proxy)
  • Dummy (does nothing)

Installation

  1. Install with Composer via composer require ostark/upper from your project directory
  2. Install plugin with this command php craft plugin/install upper or in the Craft CP under Settings > Plugins
  3. A new configuration file gets generated automatically in your-project/config/upper.php.

Fastly Setup

UPPER_DRIVER=fastly
FASTLY_API_TOKEN=<REPLACE-ME>
FASTLY_SERVICE_ID=<REPLACE-ME>
FASTLY_DOMAIN=http://<REPLACE-ME>

KeyCDN Setup

UPPER_DRIVER=keycdn
KEYCDN_API_KEY=<REPLACE-ME>
KEYCDN_ZONE_URL=<REPLACE-ME>.kxcdn.com
KEYCDN_ZONE_ID=<REPLACE-ME>

Cloudflare Setup

UPPER_DRIVER=cloudflare
CLOUDFLARE_API_TOKEN=<REPLACE-ME>
CLOUDFLARE_ZONE_ID=<REPLACE-ME>
CLOUDFLARE_DOMAIN=https://<REPLACE-ME>

By default, Cloudflare's CDN does not cache HTML content. You need to create a Cache Level: Cache Everything Page Rule to enable caching for "pages"., (*8)

If you don't use Cloudflare Enterprise with native Cache-Tag support, make sure to enable useLocalTags in your config/upper.php file (default), otherwise disable it., (*9)

You can generate a token in the Cloudflare dashboard. You want to create a custom token with the "Zone.Cache Purge" permission that is restricted to the DNS zone(s) you wish to clear Cloudflare's cache for., (*10)

Varnish Setup

Varnish URL supports multiple servers, separate with comma. E.g http://1.1.1.1,http://2.2.2.2, (*11)

UPPER_DRIVER=varnish
VARNISH_URL=<REPLACE-ME>

Tuning

In a template, you can fully disable caching like so:, (*12)

{% do upper.cache.never() %}

…which is a shorthand for:, (*13)

{% header "Cache-Control: private, no-cache" %}

By default the defaultMaxAge config setting will be used to determine the cache duration to set. This can be overridden in a template:, (*14)

{% do upper.cache.for('5 minutes') %}

…which is shorthand for:, (*15)

{% header "Cache-Control: public, s-maxage=300" %}

Performance results

example, (*16)

Cache Tag Headers

example, (*17)

Disclaimer

Even if the name of the plugin and some wordings are intentional, the author does not glorify any drug abuse. 🍻 The plugin is inspired by the joshangell/Falcon., (*18)

The Versions

10/07 2018

dev-master

9999999-dev

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cache cms cloudflare craftcms craft-plugin craft upper fastly keycdn

10/07 2018

1.3.7

1.3.7.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cache cms cloudflare craftcms craft-plugin craft fastly keycdn

18/06 2018

1.3.6

1.3.6.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cache cms cloudflare craftcms craft-plugin craft fastly keycdn

26/05 2018

1.3.5

1.3.5.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cache cms cloudflare craftcms craft-plugin craft fastly keycdn

08/05 2018

1.3.4

1.3.4.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cache cms cloudflare craftcms craft-plugin craft fastly keycdn

02/05 2018

1.3.3

1.3.3.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cache cms cloudflare craftcms craft-plugin craft fastly keycdn

05/04 2018

1.3.2

1.3.2.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cache cms cloudflare craftcms craft-plugin craft fastly keycdn

16/03 2018

1.3.1

1.3.1.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cache cms cloudflare craftcms craft-plugin craft fastly keycdn

23/02 2018

1.3.0

1.3.0.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cache cms cloudflare craftcms craft-plugin craft fastly keycdn

23/02 2018

dev-cf

dev-cf

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cache cms cloudflare craftcms craft-plugin craft fastly keycdn

23/01 2018

1.2.0

1.2.0.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft upper

23/01 2018

1.1.3

1.1.3.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft upper

22/01 2018

1.1.2

1.1.2.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft upper

05/12 2017

1.1.1

1.1.1.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft upper

24/11 2017

1.1.0

1.1.0.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft upper

23/10 2017

1.0.0

1.0.0.0

A cache plugin for Craft - supporting multiple Edge Caches

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft upper