[WordPress] 外掛分享: C3 Cloudfront Cache Controller

WordPress 外掛 C3 Cloudfront Cache Controller 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「C3 Cloudfront Cache Controller」是 2015-11-26 上架。
  • 目前有 3000 個安裝啟用數。
  • 上一次更新是 2023-03-11,距離現在已有 784 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 4.9.0 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
  • 有 3 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

hnle | jepser | miyauchi | pacifika | wokamoto | amimotoami | hideokamoto | johnbillion | megumithemes | bartoszgadomski |

外掛標籤

aws | cdn | cloudfront |

內容簡介

3>這是一個簡單的外掛,如果您發布文章,它就會清除所有 Cloudfront 緩存。
您可以輕鬆地在 WordPress 中使用 CloudFront。

Fixture (固定項)

wp_is_mobile()
檢查 CloudFront 標頭的裝置檢視器類型。
現在支援的是 HTTP_CLOUDFRONT_IS_MOBILE_VIEWER 和 HTTP_CLOUDFRONT_IS_TABLET_VIEWER。

預覽網址
在預覽頁面中,外掛程式添加 post_date 查詢以避免 CloudFront 緩存。
並設定 wordpress_loginuser_last_visit cookie 以避免 CloudFront 緩存。

如果使用者登出,則會刪除 wordpress_loginuser_last_visit cookie。

Invalidation(Clear Cache) Page URL (使頁面 URL 無效 (清除快取))

此外掛會將以下頁面 URL 傳送至 CloudFront Invalidation API。

首頁 URL
已發佈文章頁面 URL
類別存檔頁面 URL

AWS IAM Policy 範例
{
"版本: "2012-10-17",
"聲明:[
{
"作用:[
"cloudfront:GetDistribution",
"cloudfront:ListInvalidations",
"cloudfront:GetStreamingDistribution",
"cloudfront:GetDistributionConfig",
"cloudfront:GetInvalidation",
"cloudfront:CreateInvalidation"
],
"效果: "Allow",
"資源: "*"
}
]
}

透過 env vars (環境變量) 添加您的配置

可以定義以下變數來配置外掛程式:

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
C3_DISTRIBUTION_ID

可以像以下程式碼一樣將這些變數放入 wp-config.php 中:

php
define( 'AWS_ACCESS_KEY_ID', '' );
define( 'AWS_SECRET_ACCESS_KEY', '' );
define( 'C3_DISTRIBUTION_ID', '' );

Cookie

此外掛設置了名為 wordpress_loginuser_last_visit 的 Cookie 給使用者。
當使用者預覽自己的文章或內容時,它可以防止 CDN 緩存。
當從儀表板登出時,外掛程式會從使用者中刪除此 cookie。

6.1.5

[修正] 將安裝 AWS SDK 改為使用 composer 而非 aws.phar。

6.1.4

[更新] 支援 post_type_archive_link。

6.1.3

[修正] 從 v6.0.0 遺失過濾器 c3_invalidation_items。

6.1.2

[修正] PHP 版本比較問題。

6.1.1

[修正] 外掛停用問題。

6.1.0

[更新] 按 post_ids 刷新快取。

6.0.0

[破壞性變更] 重寫整個代碼。
[更新] 添加 c3_log_cron_invalidation_task 過濾器以顯示 cron 工作記錄。
[更新] 添加 c3_aws_sdk_path 過濾器以更改或刪除捆綁的 AWS SDK 路徑。

5.5.1

[更新] 使用設定子選單替換頂級選單。

5.5.0

[更新] 可以使用定義的變數來進行 AWS 憑證驗證。

5.4.2

[錯誤修正] 在預覽頁面中設置 cookie 路徑。

5.4.1

[錯誤修正] 無效化查詢 cron 事件中的未定義的路徑索引。

5.4.0

[更新] 更新預覽修復外掛程式。

原文外掛簡介

This is simple plugin that clear all cloudfront cache if you publish posts.
You can easy use CloudFront in front of WordPress.
Fixtures

wp_is_mobile()
Check device viewer type by CloudFront header.
Now supports HTTP_CLOUDFRONT_IS_MOBILE_VIEWER and HTTP_CLOUDFRONT_IS_TABLET_VIEWER.

preview url
In preview page, plugin add post_date query to avoid CloudFront cache.
And set wordpress_loginuser_last_visit cookie for avoid CloudFront cache too.

The wordpress_loginuser_last_visit cookie will be removed if user sign out.
Invalidation(Clear Cache) Page URL
This plugin send following page url to CloudFront Invalidation API.

TOP page URL
Published Post Page URL
Category Archive Page URL

AWS IAM Policy Example
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"cloudfront:GetDistribution",
"cloudfront:ListInvalidations",
"cloudfront:GetStreamingDistribution",
"cloudfront:GetDistributionConfig",
"cloudfront:GetInvalidation",
"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_SECRET_ACCESS_KEY
C3_DISTRIBUTION_ID

You can put these variables like the code into the wp-config.php
php
define( 'AWS_ACCESS_KEY_ID', '' );
define( 'AWS_SECRET_ACCESS_KEY', '' );
define( 'C3_DISTRIBUTION_ID', '' );

Cookie
This plugin set a Cookie named wordpress_loginuser_last_visit to the user.
It prevents CDN caching when the user is previewing his posts or contents.
Once logging out from Dashboard, plugin removes this cookie from user.
6.1.5

[Fix] Changed to install the AWS SDK using composer instead of aws.phar.

6.1.4

[Update] Support post_type_archive_link

6.1.3

[Fix] Lost filter c3_invalidation_items From v6.0.0

6.1.2

[Fix] php version compare issue

6.1.1

[Fix] Plugin deactivation issue

6.1.0

[Update] Flush cache by post_ids

6.0.0

[Breaking Change] Re-write entire code
[Update] Add c3_log_cron_invalidation_task filter to show cron job Logs
[Update] Add c3_aws_sdk_path filter to change or remove bundled AWS SDK path

5.5.1

[Update] Replace the top level menu with a Settings submenu

5.5.0

[Update] Can use defined variables for AWS Credentials

5.4.2

[Bug fix] Set cookie path in preview page

5.4.1

[Bug fix] Undefined Paths index in invalidation query cron event

5.4.0

[Update] Update preview fix plugin

5.3.4

[Bug fix] Small bug fix

5.3.3

[Change SDK] replace sdk

5.3.2

[Bug fix] Use EC2 role if using as AMIMOTO Managed hosting

5.3.1

[Add filter] Can select AWS SDK version by filter

5.3.0

[Update SDK] Use AWS SDK v3 when you using php 5.6 or later

5.2.1

[For AMIMOTO Managed] bug fix to run by WP-CLI

5.2.0

[Add filter] We can disable to register wp-cron that retry request invalidation.
[Readme] Update readme to see IAM Policy example.

5.1.0

[Update preview fixture] Set cookie to avoid CloudFront cache if user sign in
[Update preview fixture] Unset cookie for avoide CloudFront cache if user sign out

5.0.0

Support CloudFront viewer params on wp_is_mobile().(4.9.0 or later)

4.4.0

Fix small bug
Add some feature for AMIMOTO Managed hosting user

4.3.1

Fix cron interval
add filters 'c3_invalidation_interval, c3_invalidation_cron_interval, c3_invalidation_item_limits.
update default invalidation interval & items.

4.3.0

Schedule cron event if you published many post at the same time

4.2.1

Fix ‘c3_credential’ filter position

4.2.0

Support AMIMOT Dashboard

4.1.0

Show Invalidation Logs

4.0.3

Auto Deploy by Travis

4.0.2

Add WP-CLI param check ( wp c3 flush)
change transient_key

4.0.1

Bug fix ( conflict Nephila Clavata )

4.0.0

Support AWS SDK Version3
Remove action hook -> ‘c3_add_setting_before’
use ‘c3_after_title’ filter hook instead.
Remove action hook -> ‘c3_add_setting_after’
use ‘c3_after_auth_form’ filter hook instead.

3.0.0

Include CF Preview Fix plugin
Rename

2.4.3

Fix Catch Exception BUG

2.4.2

Fix CLI BUG

2.4.1

Fix CLI BUG

2.4.0

Add WP-CLI Command ( Update Settings )

2.3.0

Add WP-CLI Command

2.2.2

Force Invalidation

2.2.1

Fix Typo

2.2.0

Add Filter for using EC2 Instance Role.
Translationable in t.w.org

2.1.1

Fix too many invalidation url error.

2.1.0

Add hook to customize invalidation URL
support new invalidation url, terms.
Manualy invalidation button added

2.0.2

Change AWS SDK
code refactoring by wokamoto
Invalidation URL

2.0.1

Change AWS SDK
code refactoring by wokamoto
Invalidation URL

1.0

Initial released.

6.1.0

[Fix] Plugin deactivation issue

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「C3 Cloudfront Cache Controller」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


2.0.0 | 2.0.1 | 6.1.4 | 6.1.5 | trunk |

延伸相關外掛(你可能也想知道)

  • W3 Total Cache 》W3 Total Cache (W3TC) 透過整合內容傳遞網絡 (CDN) 和最新最佳實踐等功能,提高網站性能、減少加載時間,增進 SEO、核心 Web 主要指標和整體用戶體驗。W3TC ...。
  • SpeedyCache – Cache, Optimization, Performance 》SpeedyCache 是一款 WordPress 外掛,能透過網頁快取、最小化檔案和檔案壓縮的方式,幫助您減少網站載入時間。, 您可以在 https://speedycache.com/docs 找到...。
  • Breeze – WordPress Cache Plugin 》Breeze是由Cloudways團隊開發的一款免費、簡單(卻功能強大)且使用者友好的WordPress快取外掛。它提供不同層級的WordPress效能優化選項,在WordPress、搭配W...。
  • Use Google Libraries 》e's content distribution network (CDN) URLs for the supported libraries., This hook is used to replace the default WordPress registered script sour...。
  • Pantheon Advanced Page Cache 》, 對於希望對其頁面緩存作出細粒度控制的網站,Pantheon Advanced Page Cache 是實現這一目的的黃金工具。以下是該外掛程式運作的概述:, , 當響應產生時,該...。
  • CDN Enabler 》CDN Enabler 是一個簡單易用的 WordPress 外掛,可以將 CSS、JavaScript 和圖像等 URL 重寫為經由內容傳遞網路 (CDN) 提供,以提升網站效能、可靠性和擴展性...。
  • bunny.net – WordPress CDN Plugin 》使用bunny.net內容分發網絡可以加快您的網站速度。此外掛可讓您輕鬆在WordPress上啟用Bunny CDN,並享受全球得到極大改善的頁面加載速度。更好的是,只需一分...。
  • Swift Performance Lite 》——WordPress外掛介紹——, , 需要速度。WordPress的緩存和性能外掛!, 您創建了它,而我們讓它保持快速!您知道嗎……, 您只有3秒鐘的時間來給來訪者留下印象。不...。
  • Jetpack VideoPress 》WordPress 最佳的精美影片主機, VideoPress 具有沉浸式的設計,非常適合想要輕鬆上傳高質量影片的攝影師、創作者、電影製作人、教育工作者和部落客。, 專為 W...。
  • Flying Images: Optimize and Lazy Load Images for Faster Page Speed 》優化圖片的完整解決方案, 功能特點, , 免費無限CDN – Flying Images 使用Statically提供免費的CDN。Statically由Cloudflare(高級網絡)、BunnyCDN、Fa...。
  • WP-Stateless – Google Cloud Storage 》使用 WP-Stateless 外掛,您可以將 WordPress 媒體從 Google Cloud Storage (GCS) 上傳和提供服務。只需兩分鐘,您就可以從 Google Cloud 的分佈式伺服器中受...。
  • GoCache 》透過這個 WordPress 外掛,您可以將您的 WordPress 網站連接至 GoCache。GoCache 擁有智慧型加速技術,能夠加速網站的靜態網頁和檔案,同時減少網頁伺服器和...。
  • Microsoft Azure Storage for WordPress 》這個 WordPress 外掛允許您使用 Microsoft Azure 儲存服務來托管您的 WordPress 網站媒體和上傳檔案。Microsoft Azure 儲存是一種有效的方式,可以無限擴展您...。
  • SmartVideo – Video Player and CDN 》這是一個為 WordPress 使用者提供無限制影片儲存和播放的外掛。, 為什麼要使用這個影片播放器外掛?, 這個外掛可以:, , 在幾秒鐘內在您的網站上添加影片, 優...。
  • BerqWP – Automated All-In-One PageSpeed Optimization for Core Web Vitals, Cache, CDN, Images, CSS, and JavaScript 》SearchPro 可以透過 WordPress Rest API,讓使用者輕鬆地找到相關內容。它可以從 WordPress 文章、頁面、WooCommerce 產品,甚至是自訂文章類型中的標題和內...。

文章
Filter
Apply Filters
Mastodon