pixelcode/cacheheadercontrol 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pixelcode/cacheheadercontrol

Composer 安装命令:

composer require pixelcode/cacheheadercontrol

包简介

Craft plugin for setting HTTP cache control headers

README 文档

README

Build Status Code Climate Test Coverage Issue Count

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

Installation

Install it with Composer:

composer require pixelcode/cacheheadercontrol

Usage

Use it in your template(s):

{% http_cache %}

This will set the headers based on the plugin configuration.

{% http_cache false %}

This will disable cache for the template.

{% 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.

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

Configuration

Options

enableCache

Default: true

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.

defaultCacheExpiration

Default: +15 minutes

Default expiration used when you use '{% http_cache %}' without any custom options.

Overwrite configuration

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

Example for overwriting the default expiration:

<?php

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

统计信息

  • 总下载量: 218
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固