[WordPress] 外掛分享: Cache control by Cacholong

WordPress 外掛 Cache control by Cacholong 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Cache control by Cacholong」是 2018-03-05 上架。
  • 目前有 500 個安裝啟用數。
  • 上一次更新是 2021-07-20,距離現在已有 1384 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 4.3.1 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 5.6 以上。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

preliot | cacholong |

外掛標籤

cache | caching | cacholong | pagespeed | cache-control |

內容簡介

>「Cache control by Cacholong」插件可以自動在您的Nginx服務器上清除Nginx Pagespeed快取和Nginx FastCGI快取。這是一個後端插件,能夠:

清除Nginx Pagespeed和/或Nginx FastCGI快取。
可以自動或手動清除快取,使用WordPress cronjobs和WP-CLI。
在一個或多個服務器上清除快取(有關更多詳細信息,請參閱hosts.json部分)。
使用命令行(WP-CLI)清除快取或重置為出廠設置。
從樣式表鏈接標籤中刪除ID標籤,以允許Nginx Pagespeed合併樣式表。
允許清除其他緩存項目(參見“設置” > “快取控制”)。
通知用戶清除狀態。
支持單站點和網絡站點
支持WP-CLI
支持WPML(包括語言協商類型域)

什麼時候會清除快取?

此插件將與默認和自定義文章類型一起工作。它會在保存、定期更新、快速編輯更新、標記更改、刪除和取消刪除時清除。用戶將收到一個或多個消息以進行通知。
有一些注意事項:

當用戶使用Gutenberg編輯器時,清除消息將不會顯示。
當用戶使用“快速編輯”和“更新”修改文章時,不會顯示任何消息,因為沒有頁面刷新。這些消息將顯示在下一個請求中。

可以使用WordPress cronjobs清除快取。調整“Cronjob設置”以執行每天清除快取。

您也可以手動清除項目。轉到WordPress儀表板,導航至:

設置 > 快取控制 > 清除單個項目
設置 > 快取控制 > 清除所有緩存
管理工具列 > 清除所有緩存

設置

主機文件(JSON):文件帶有有關此WordPress安裝的一個或多個主機信息。有關更多詳細信息,請參閱hosts.json部分。
Pagespeed優化CSS:刪除所有WordPress樣式表鏈接標籤中的ID標籤,以改善Nginx Pagespeed緩存。僅適用於前端。
清除設置默認文章類型:在清除默認文章類型時,選擇一個或多個選項。可以清除文章URL(默認)、首頁、所有相關的WordPress分類或所有緩存。
清除設置默認自定義類型(s):在清除自定義文章類型時,選擇一個或多個選項。可以清除文章URL(默認)、首頁、所有相關的WordPress分類或所有緩存。

Cronjob設置

計劃程序清除:啟用或禁用計劃程序清除。
每天的Cronjob時間:輸入24小時符號(HH:MM)以設置每天的Cronjob時間。如果格式錯誤,則會回退到00:00。
清除緩存:選擇要在給定的Cronjob時間清除的緩存。

hosts.json

Hosts.json是一個帶有有關此WordPress安裝的一個或多個服務器信息的JSON文件。請記住,此文件必須包含所有服務器的信息,包括帶有此插件的服務器。默認路徑為:wp-content/uploads/cacholong-cache-control/hosts.json。

以下是一個hosts.json文件的示例:

{"servers":
[
{"name": "server1", "ip": "127.0.0.1", "pagespeed": true, "fastcgi": false},
{"name": "server2", "ip": "127.0.0.2", "pagespeed": false, "fastcgi": true},
]
}

每行都包含有關一個服務器的信息。參數:

名稱(字符串)

原文外掛簡介

“Cache control by Cacholong” plugin automates purging of Nginx Pagespeed cache and Nginx FastCGI cache on your Nginx server(s). It is a backend plugin that is able to:

Purge Nginx Pagespeed cache and/or Nginx FastCGI cache.
Purge cache automatically, manually, with WordPress cronjobs and WP-CLI.
Purge caches on one or more servers (See hosts.json section for more details).
Use commandline (WP-CLI) to purge caches or reset to factory settings.
Remove id tag from stylesheet link tags, in order to allow Nginx Pagespeed to combine stylesheets.
Allow purging of other cached items (see Settings > Cache control).
Inform user of purge status.
Support for single site and network sites
Support for WP-CLI
Support for WPML (including language negotiation type domain)

When will it purge?
This plugin will work with default and custom post types. It will purge on a save, regular update, quick edit update, slug change, delete and undelete. The user is informed with one or more messages.
There are a few caveats:

When a user is using the Gutenberg editor, purge messages will not be displayed.
When the user uses “Quick edit” and “Updates” the post, no messages will be displayed, because there’s no page refresh. Those messages will be shown on the next request.

It is possible to purge with WordPress cronjobs. Adjust the ‘Cronjob settings’ to perform a daily purge of caches.
You can also purge items manually. Go to the WordPress dashboard and navigate to:

Settings > Cache control > purge single item
Settings > Cache control > purge all caches
Admin Toolbar > purge all caches

Settings

File with hosts (JSON): File with information about one or more hosts for this WordPress installation. See hosts.json section for more details.
Pagespeed optimized CSS: Remove ID tag from all WordPress stylesheet link tags to improve Nginx Pagespeed caching. Will only work on frontend.
Purge settings default post types: Select one or more options when purging a default post type. Possible to purge post url (default), home page, all connected WordPress categories or all caches.
Purge settings default custom type(s): Select one or more options when purging a custom post type. Possible to purge post url (default), home page, all connected WordPress categories or all caches.

Cronjob Settings

Cronjob purging: Enable or disable cronjob purging.
Cronjob time of each day: Enter HH:MM in 24 hour notation for cronjob time of day. Will fallback to 00:00 when wrong format is given.
Purge caches Select caches to purge on given cronjob time.

hosts.json
Hosts.json is a JSON file with information about one or more servers for this WordPress installation. Remember that this file must contain information about all servers, including the
one with this plugin. Default path is: wp-content/uploads/cacholong-cache-control/hosts.json.
Here is an example of a hosts.json file:
{"servers":
[
{"name": "server1", "ip": "127.0.0.1", "pagespeed": true, "fastcgi": false},
{"name": "server2", "ip": "127.0.0.2", "pagespeed": false, "fastcgi": true},
]
}

Each line contains information about one server. Parameters:

name (string)
Name of host, something to identify this server.

ip (string)
IP address of server or full url. Format: scheme://host:port/path

pagespeed (bool)
Server uses Nginx Pagespeed (true) or not (false)

fastcgi (bool)
Server user Nginx FastCGI (true) or not (false)

When there is no hosts.json or the path is invalid, this plugin assumes the following:
{"servers":
[
{"name": "localhost", "ip": "127.0.0.1", "pagespeed": true, "fastcgi": true}
]
}

How does it work
“Cache control by Cacholong” empties partial or full cache for Nginx Pagespeed and FastCGI cache. WordPress HTTP API is used to make (post) request to
specific urls to trigger purges. Based on the http header responses this plugin determines if a purge is successful or not. The user is informed with messages, which are loaded after a purge and page refresh.
There are several settings to tweak purging, see Settings > Cache control.
WP-CLI
There are several commands available for the commandline with wp-cli. Commands generate text output which can be suppressed with –quiet. When an error occurs, text will always be displayed.
WP-CLI exit codes
Exit codes are 0 (no errors) or 1 (generic error).
WP-CLI examples
Purge command with all arguments:
wp cacholong_cc purge [--cache=] [--ips=]

Purge Nginx FastCGI:
wp cacholong_cc purge --cache=fastcgi

Purge Nginx Pagespeed:
wp cacholong_cc purge --cache=pagespeed

Purge all caches:
wp cacholong_cc purge --cache=all
wp cacholong_cc purge

Purge Nginx Pagespeed cache for ip address 127.0.0.1 and 127.0.0.2:
wp cacholong_cc purge --cache=pagespeed --ips=127.0.0.1,127.0.0.2

Purge all caches for ip address 127.0.0.1 and 127.0.0.2:
wp cacholong_cc purge --ips=127.0.0.1,127.0.0.2

Factory reset options for given site_id or current blog if no site_id is given:
wp cacholong_cc factory_reset [--site_id=site_id]

Debug
Plugin will log basic purge information when WP_DEBUG is true (can be set in wp-config.php). Logs information in file wp-content/cacholong-cache-control.log.
Plugin will log wp_remote_request details when CACHOLONG_CACHE_DEBUG_HTTP_API_REQUEST is true (can be set in wp-config.php). Logs information in file wp-content/cacholong-cache-control.log.

各版本下載點

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

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


4.0.0 | 4.0.1 | 4.0.2 | 4.1.1 | 5.0.0 | 5.1.0 | 5.3.2 |

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

  • LiteSpeed Cache 》LiteSpeed Cache for WordPress(LSCWP)是一種全方位的網站加速外掛,包括獨家的伺服器層快取和一系列的優化功能。, LSCWP 支援 WordPress Multisite 及大多...。
  • WP Super Cache 》本外掛可以從您的動態 WordPress 部落格生成靜態 HTML 檔案。在產生 HTML 檔案後,您的網頁伺服器會傳送該檔案,而不是處理比較沉重、耗費更多資源的 WordPre...。
  • WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 》WP-Optimize Cache 是一個革命性的、全方位的 WordPress 效能外掛,將您的網站做快取、清理資料庫及圖片壓縮,讓您的網站快速且最佳化。我們的快取功能是建構...。
  • W3 Total Cache 》W3 Total Cache (W3TC) 透過整合內容傳遞網絡 (CDN) 和最新最佳實踐等功能,提高網站性能、減少加載時間,增進 SEO、核心 Web 主要指標和整體用戶體驗。W3TC ...。
  • Speed Optimizer – The All-In-One Performance-Boosting Plugin 》SiteGround Optimizer 插件是由 SiteGround 開發的,可以大幅提高任何托管環境下的 WordPress 網站性能。, 最初設計用於 SiteGround 的服務器,現在已經有近 ...。
  • Breeze – WordPress Cache Plugin 》Breeze是由Cloudways團隊開發的一款免費、簡單(卻功能強大)且使用者友好的WordPress快取外掛。它提供不同層級的WordPress效能優化選項,在WordPress、搭配W...。
  • Redis Object Cache 》一個由 Redis 提供支援的持久化物件快取後端。支援 Predis、PhpRedis (PECL)、Relay、複寫、哨兵、叢集化和 WP-CLI。, 若要調整連線參數、前綴的快取鍵或設定...。
  • Hummingbird Performance – Cache & Page Speed Optimization for Core Web Vitals | Critical CSS | Minify CSS | Defer CSS Javascript | CDN 》Hummingbird 透過添加細調控制文件壓縮、延後 CSS 和 JavaScript 樣式和腳本、CSS 和 JS 壓縮,以及懶加載等全球最佳緩存優化方法,讓您的網站更快,並優化網...。
  • Cache Enabler 》Cache Enabler 是個簡單卻強大的 WordPress 快取外掛,使用起來簡單且只需要最小化的設定,最重要的是能夠幫助網站提升效能來達到更快的載入時間。它會將前端...。
  • Super Page Cache 》為何要選擇這個外掛?, 這個 Super Page Cache for Cloudflare 外掛可以讓您的網站加速,將網站快取提升至另一個層級。此外,這個外掛不僅會快取靜態文件(例...。
  • SpinupWP 》這個外掛確保在您的網站內容更改時清除 SpinupWP 頁面快取。還沒使用 SpinupWP 嗎?請在此註冊。, SpinupWP是一個現代的伺服器控制面板,旨在協助您實施每次...。
  • WP Meteor Website Speed Optimization Addon 》 , WP Meteor 是一種全新的優化網頁速度的方式。即使在現有的優化基礎之上,例如:, , Autoptimize, WP Rocket, WP Total Cache, WP Super Cache, , WP Meteo...。
  • Server-Side Cache AutoPurge 》這個外掛能在您進行網站變更(例如更新文章)後自動清除伺服器端快取。, 自動清除功能僅適用於由SureSupport管理的使用主機控制面板中提供的「伺服器端快取」...。
  • Leverage Browser Caching 》這個 WordPress 外掛名稱就是『Leverage Browser Caching』,它可以解決你的 WordPress 網站中與檔案快取相關的問題,同時也可以提升網站在 Pingdom、GTmetri...。
  • Cachify 》Cachify 通過將帖子、頁面和自訂帖子類型作為靜態內容緩存,優化您的頁面載入。您可以選擇通過數據庫、網頁服務器的硬盤驅動器(HDD)、Memcached(僅在 Ngin...。

文章
Filter
Mastodon