2017 © Pedro Peláez
 

craft-plugin cacheheadercontrol

Craft plugin for setting HTTP cache control headers

image

pixelcode/cacheheadercontrol

Craft plugin for setting HTTP cache control headers

  • Thursday, February 9, 2017
  • by pixelcode
  • Repository
  • 3 Watchers
  • 0 Stars
  • 102 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 3 % Grown

The README.md

Craft HTTP cache header control plugin

Build Status Code Climate Test Coverage Issue Count, (*1)

This plugin makes it easier to set up an Cache-Control and Expiration HTTP header from your templates., (*2)

Installation

Install it with Composer:, (*3)

composer require pixelcode/cacheheadercontrol

Usage

Use it in your template(s):, (*4)

{% http_cache %}

This will set the headers based on the plugin configuration., (*5)

{% http_cache false %}

This will disable cache for the template., (*6)

{% http_cache '+5 minutes' %}

This will set the cache expiration to 5 minutes after the current time, so the template will be cached for 5 minutes., (*7)

You can use all 'strtotime' formats here, see http://php.net/manual/en/function.strtotime.php., (*8)

Configuration

Options

enableCache

Default: true, (*9)

Enable or disable cache headers. If this is set to 'false' and you add the 'http_cache' tag to a template, the Expiration header will get the value of {time} - 1 second., (*10)

defaultCacheExpiration

Default: +15 minutes, (*11)

Default expiration used when you use '{% http_cache %}' without any custom options., (*12)

Overwrite configuration

You can overwrite the configuration by creating a PHP file with the name 'cacheHeaderControl.php' in the 'craft/config' folder., (*13)

Example for overwriting the default expiration:, (*14)

<?php

return [
    'defaultCacheExpiration' => '+5 minutes',
];

The Versions

09/02 2017

dev-master

9999999-dev

Craft plugin for setting HTTP cache control headers

  Sources   Download

MIT

The Development Requires

08/02 2017

1.0.0

1.0.0.0

Craft plugin for setting HTTP cache control headers

  Sources   Download

MIT

The Development Requires