[wordpress插件] C3 Cloudfront Cache ControllerC3 Cloudfront缓存控制器

wordpress 插件 文章 2020-03-15 03:00 519 0 全屏看文

AI助手支持GPT4.0

评分
80
描述

This is simple plugin that clear all cloudfront cache if you publish posts.

这是一个简单的插件,可以在发布帖子时清除所有Cloudfront缓存。

You can easy use CloudFront in front of WordPress.

您可以在WordPress之前轻松使用CloudFront。

Fixtures

固定装置

    • wp_is_mobile()

      wp_is_mobile()

      Check device viewer type by CloudFront header.

      通过CloudFront标头检查设备查看器类型。

      Now supports HTTP_CLOUDFRONT_IS_MOBILE_VIEWER and HTTP_CLOUDFRONT_IS_TABLET_VIEWER.

      现在支持 HTTP_CLOUDFRONT_IS_MOBILE_VIEWER HTTP_CLOUDFRONT_IS_TABLET_VIEWER

    • preview url

      预览网址

      In preview page, plugin add post_date query to avoid CloudFront cache.

      在预览页面中,插件添加 post_date 查询以避免CloudFront缓存。

      And set wordpress_loginuser_last_visit cookie for avoid CloudFront cache too.

      并设置 wordpress_loginuser_last_visit cookie以避免CloudFront缓存。

    The wordpress_loginuser_last_visit cookie will be removed if user sign out.

    如果用户退出,则将删除 wordpress_loginuser_last_visit cookie。

    Invalidation(Clear Cache) Page URL

    无效(清除缓存)页面网址

    This plugin send following page url to CloudFront Invalidation API.

    此插件将以下页面网址发送到CloudFront Invalidation API。

      • TOP page URL
      • TOP页面网址

      • Published Post Page URL
      • 发布的帖子页面URL

      • Category Archive Page URL
      • 类别存档页面URL

      AWS IAM Policy Example

      AWS IAM策略示例

      {    

        {    

      "Version": "2012-10-17",    

      “ Version”:“ 2012-10-17”,    

      "Statement": [        

      “声明”:[        

      {            

      {            

      "Action": [                

      “动作”:[                

      "cloudfront:GetDistribution",                

      “ cloudfront:GetDistribution”,                

      "cloudfront:ListInvalidations",                

      “ cloudfront:ListInvalidations”,                

      "cloudfront:GetStreamingDistribution",                

      “ cloudfront:GetStreamingDistribution”,                

      "cloudfront:GetDistributionConfig",                

      “ cloudfront:GetDistributionConfig”,                

      "cloudfront:GetInvalidation",                

      “ cloudfront:GetInvalidation”,                

      "cloudfront:CreateInvalidation"            

      “ cloudfront:CreateInvalidation”            

      ],            

      ],            

      "Effect": "Allow",            

      “效果”:“允许”,            

      "Resource": "*"        

      “资源”:“ *”        

      }    

      }    

      ]

      ]

      }

      }

      Adding your configuration through env vars

      通过环境变量添加配置

      The plugin can be configured by defining the following variables:

      可以通过定义以下变量来配置插件:

        • AWS_ACCESS_KEY_ID
        • AWS_ACCESS_KEY_ID

        • AWS_SECRET_ACCESS_KEY
        • AWS_SECRET_ACCESS_KEY

        • C3_DISTRIBUTION_ID
        • C3_DISTRIBUTION_ID

        You can put these variables like the code into the wp-config.php

        您可以将这些变量(如代码)放入wp-config.php

        php

          php

        define( 'AWS_ACCESS_KEY_ID', '' );

        define('AWS_ACCESS_KEY_ID','');

        define( 'AWS_SECRET_ACCESS_KEY', '' );

        define('AWS_SECRET_ACCESS_KEY','');

        define( 'C3_DISTRIBUTION_ID', '' );

        define('C3_DISTRIBUTION_ID','');

        Cookie

        饼干

        This plugin set a Cookie named wordpress_loginuser_last_visit to the user.

        此插件为用户设置了一个名为 wordpress_loginuser_last_visit 的Cookie。

        It prevents CDN caching when the user is previewing his posts or contents.

        当用户预览其帖子或内容时,它可以防止CDN缓存。

        Once logging out from Dashboard, plugin removes this cookie from user.

        从仪表板注销后,插件将从用户中删除此Cookie。

安装步骤

    1. Activate the plugin through the ‘Plugins’ menu in WordPress
    2. 通过WordPress中的“插件”菜单激活插件

    3. Create IAM user to attach valid IAM Policy for AWS CloudFront
    4. 创建IAM用户以为AWS CloudFront附加有效的IAM策略

    5. Configure the plugin settings from wp-admin
    6. 从wp-admin配置插件设置

下载地址
https://downloads.wordpress.org/plugin/c3-cloudfront-clear-cache.zip
-EOF-

AI助手支持GPT4.0