前言介紹
- 這款 WordPress 外掛「API Cache Pro」是 2019-09-29 上架。
- 目前尚無安裝啟用數,是個很新的外掛。如有要安裝使用,建議多測試確保功能沒問題!
- 上一次更新是 2022-04-18,距離現在已有 1112 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 5.0 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 7.0 以上。
- 尚未有人給過這款外掛評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
bhubbard | hubbardlabs |
外掛標籤
api | cache | api-cache-pro |
內容簡介
這個外掛程式可以啟用 WordPress 的 REST API 快取以提高效能。啟用後,您可以通過自訂器調整基本設置。
自訂器選項:
禁用快取(預設值:已關閉)
設置預設快取超時時間(預設值:300 秒)
請求標頭
所有 API 請求都會添加幾個標頭。此外掛還會修改 Cache-Control 標頭。以下是可用自訂標頭的示例。
X-API-CACHE-PRO:Cached
X-API-CACHE-PRO-EXPIRES:2019年1月20日12:39UTC
X-API-CACHE-PRO-EXPIRES-DIFF:5分鐘
X-API-CACHE-PRO-KEY:api_cache_pro_78be25416f69cd3a885dcf14017a0691
X-API-CACHE-PRO - 顯示已快取或未快取。
X-API-CACHE-PRO-EXPIRES - 顯示緩存過期的日期/時間。
X-API-CACHE-PRO-EXPIRES-DIFF - 显示当前时间到缓存过期时间的差异。
X-API-CACHE-PRO-KEY - 顯示用於快取的鍵。
此外掛提供幾個過濾器,以便您可以禁用這些標頭:
過濾器
類型
預設值
api_cache_pro_header
布林值
true
api_cache_pro_key_header
布林值
true
api_cache_pro_expires_header
布林值
true
api_cache_pro_expires_diff_header
布林值
true
api_cache_pro_control_header
布林值
true
api_cache_pro_max_age
整數
預設超時時間(300 秒或 5 分鐘)
api_cache_pro_s_max_age
整數
預設超時時間(300 秒或 5 分鐘)
您可以使用這些過濾器來停用任何標頭。以下是禁用 Key 標頭的示例。
/**
* 禁用 API Cache Pro Key 標頭。
*
* @access public
*/
function disable_api_cache_pro_key_header() {
return false;
}
add_action( 'api_cache_pro_key_header', 'disable_api_cache_pro_key_header' );
清除快取
如果您執行以下任一操作,快取將自動清除:
禁用快取
更新預設快取超時長度
更新任何文章、頁面或自訂文章類型。
停用或解除安裝外掛
您可以通過向任何請求添加以下參數來跳過該快取:
`cache=disabled
API Cache Pro 提供 wp-cli 支持以使用以下命令清除快取:
wp api-cache-pro delete
原文外掛簡介
This plugin enables caching for the WordPress REST API to improve performance. Once enabled you can modify the basic settings via the Customizer.
Customizer Options:
Disable Cache (Default: Disabled)
Set Default Cache Timeout (Default: 300)
Request Headers
Several Headers are added to all the API Requests. This plugin will also modify the Cache-Control header as well. Here is an example of the available custom headers.
X-API-CACHE-PRO: Cached
X-API-CACHE-PRO-EXPIRES: January 20, 2019, 12:39 AM UTC
X-API-CACHE-PRO-EXPIRES-DIFF: 5 mins
X-API-CACHE-PRO-KEY: api_cache_pro_78be25416f69cd3a885dcf14017a0691
X-API-CACHE-PRO – Displays Cached, or Not Cached.
X-API-CACHE-PRO-EXPIRES – Displays the date/time the cache is set to expire.
X-API-CACHE-PRO-EXPIRES-DIFF – Displays the difference from current time to the time cache is set to expire.
X-API-CACHE-PRO-KEY – Displays the key used for the cache.
This plugin offers several filters so you can disable these headers:
Filter
Type
Default
api_cache_pro_header
boolean
true
api_cache_pro_key_header
boolean
true
api_cache_pro_expires_header
boolean
true
api_cache_pro_expires_diff_header
boolean
true
api_cache_pro_control_header
boolean
true
api_cache_pro_max_age
integer
Default Timeout or 300 (5 Minutes)
api_cache_pro_s_max_age
integer
Default Timeout or 300 (5 Minutes)
You can use these filters to disable any of the headers. Here is an example to disable the Key Header.
/**
* Disable API Cache Pro Key Header.
*
* @access public
*/
function disable_api_cache_pro_key_header() {
return false;
}
add_action( 'api_cache_pro_key_header', 'disable_api_cache_pro_key_header' );
Clearing Cache
The cache will automatically get cleared if you do any of the following:
Disable the Cache
Update the Default Cache Timeout Length
Update any post, page or custom post type.
Deactivate or Uninstall the plugin
You can skip that cache by adding the following param to any request:
`cache=disabled
WP-CLI Support
API Cache Pro offers wp-cli support to clear cache with the following command:
wp api-cache-pro delete
`各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「API Cache Pro」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
0.0.7 |
延伸相關外掛(你可能也想知道)
暫無相關外掛推薦。