jan-herman/kirby-siteground-cache 问题修复 & 功能扩展

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

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

jan-herman/kirby-siteground-cache

Composer 安装命令:

composer require jan-herman/kirby-siteground-cache

包简介

Kirby cache driver for SiteGround web hosting.

README 文档

README

Kirby cache driver for purging SiteGround Dynamic Cache and controlling SiteGround cache headers from Kirby's pages cache configuration.

Installation

Install the plugin and enable it as the pages cache driver:

return [
    'cache' => [
        'pages' => [
            'active' => true,
            'type'   => 'siteground',
        ]
    ]
];

Options

maxAge

Set maxAge to send a Cache-Control: max-age=<seconds> header for rendered HTML pages. SiteGround uses this header to control how long the page should be kept in the Dynamic Cache.

return [
    'cache' => [
        'pages' => [
            'active' => true,
            'type'   => 'siteground',
            'maxAge' => 6000,
        ]
    ]
];

If maxAge is not configured, the plugin does not send a cache lifetime header and SiteGround's default cache duration applies.

ignore

Use Kirby's native pages cache ignore option to exclude pages from SiteGround Dynamic Cache. Ignored pages send Cache-Control: no-cache.

return [
    'cache' => [
        'pages' => [
            'active' => true,
            'type'   => 'siteground',
            'maxAge' => 6000,
            'ignore' => fn ($page) => $page->template()->name() === 'contact',
        ]
    ]
];

You can also ignore pages by ID:

return [
    'cache' => [
        'pages' => [
            'active' => true,
            'type'   => 'siteground',
            'ignore' => ['contact', 'private-area'],
        ]
    ]
];

Purging

Logged-in users can visit /flush-cache to purge Kirby's pages cache, which also purges SiteGround Dynamic Cache.

You can also purge the cache with the Kirby CLI:

vendor/bin/kirby clear:cache

Any code or command that calls kirby()->cache('pages')->flush() will trigger the SiteGround purge as well.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固