fork / craft-akamai-invalidator
为页面分配缓存标签并在保存时使它们无效。
1.4.1
2023-12-01 13:54 UTC
Requires
- php: >=8.1
- akamai-open/edgegrid-client: ^2.0
- craftcms/cms: ^4.4.7.1
Requires (Dev)
- craftcms/ecs: dev-main
- craftcms/phpstan: dev-main
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网络。可以是staging
或production
。edgeRcSection
—.edgerc
中的凭据部分edgeRcPath
—.edgerc
文件的路径。可以使用Craft别名。
