fork/craft-akamai-invalidator

为页面分配缓存标签并在保存时使它们无效。

1.4.1 2023-12-01 13:54 UTC

This package is auto-updated.

Last update: 2024-08-30 01:44:15 UTC


README

为页面分配缓存标签并在保存时使它们无效。

功能

  • 根据条目ID为每个响应分配缓存标签。
  • 在保存条目时自动使缓存标签无效。
  • 通过all缓存标签使整个网站无效。

要求

此插件需要Craft CMS 4.4.7.1或更高版本,以及PHP 8.1或更高版本。

安装

打开您的终端并运行以下命令

# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require fork/craft-akamai-invalidator

# tell Craft to install the plugin
./craft plugin/install akamai-invalidator

配置

Akamai身份验证

要生成您的Akamai凭据,请参阅创建身份验证凭据

.edgerc文件放置在Craft根目录下。

插件配置

要配置插件,创建一个包含以下选项的文件config/akamai-invalidator.php

<?php

return [
    'invalidateOnSave' => true,
    'enableInvalidateAll' => false,
    'network' => 'staging',
    'edgeRcSection' => 'default',
    'edgeRcPath' => '@root/.edgerc',
];

配置选项

  • invalidateOnSave — 是否在条目保存时自动使缓存无效
  • enableInvalidateAll — 是否可以通过Craft缓存清除选项一次性使所有页面无效。
  • network — 缓存无效操作的Akamai网络。可以是stagingproduction
  • edgeRcSection.edgerc中的凭据部分
  • edgeRcPath.edgerc文件的路径。可以使用Craft别名
Fork Logo

Fork Unstable Media GmbH提供