OPcache Reset

外掛說明

這個外掛會在更新 WordPress 核心程式、佈景主題及檔案後清除 OPcache 快取。與其他外掛不同,這個外掛與透過 Linux cron 執行 WordPress 更新相容。

外掛功能

  • 在更新 WordPress 核心程式/外掛/佈景主題後自動重設 OPcache。
  • 清除記憶體及檔案層級的 OPcache 快取。
  • 可以與 cron 命令執行的 WordPress 更新搭配使用。
  • 提供手動管理 OPcache 快取的 WP-CLI 命令。
  • 沒有外部相依性 (cachetool 為選用支援)。

組態方式

這個外掛會自動處理網頁更新。如果要使用 CLI 進行更新 (例如 cron 或 WP-CLI),必須組態伺服器上的 PHP-FPM 通訊端:

方法 1:在 WordPress 網站跟目錄建立 .cachetool.yml 檔案:

adapter: fastcgi
fastcgi: /run/php-fpm/www.sock

方法 2:使用 cachetool 二進位檔案 (必須已安裝在 PATH 環境變數中)

WP-CLI 命令

使用命令列重設 OPcache 快取:

wp opcache reset

顯示 OPcache 快取狀態及統計資料:

wp opcache status

將 OPcache 快取狀態輸出為 JSON 檔案:

wp opcache status --format=json

使用者評論

2019 年 5 月 27 日
This almost what I have been looking for. The OPCache is also reset when installing new plugins, but not when deinstalling.
閱讀全部 1 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈OPcache Reset〉的開發相關工作。

參與者

〈OPcache Reset〉外掛目前已有 1 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將〈OPcache Reset〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

2.4.0

  • Added WP-CLI commands: wp opcache reset and wp opcache status
  • Added direct FastCGI communication (no cachetool dependency required)
  • Added support for cachetool.yml configuration format
  • Added end-to-end FastCGI testing
  • Improved test coverage (34 tests)

2.3.0

  • Added comprehensive Docker-based integration test suite (27 tests)
  • Added GitHub Actions CI for linting and testing
  • Added PHPStan and PHPCS for code quality
  • Improved OPcache reset verification with validate_timestamps=0 testing
  • Added pre-commit hooks for automated code checks
  • Updated plugin assets (icons, banners)

2.2.0

  • Added support for file-based OPcache clearing with race condition handling
  • Improved cachetool invocation with proper PATH handling

2.1.2

  • No calling cachetool opcache:reset for setups with only file cache

2.1.0

  • Handle file OPcaches in a consistent fashion

2.0.0

  • Handle file OPCaches

1.0.0

  • Initial release.