[WordPress] 外掛分享: WP File Cache

首頁外掛目錄 › WP File Cache
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
700+
安裝啟用
★★★☆☆
3.5/5 分(2 則評價)
5591 天前
最後更新
問題解決
WordPress 2.6+ v1.2.9.1 上架:2010-02-11

內容簡介

這個外掛實現了物件級持久性快取,可以作為 WordPress 內置的 WP_Object_Cache 的替代品使用。
與 WP Super Cache、Hyper Cache 和其他外掛不同,WP File Cache 不會快取整個頁面,而是快取 WordPress 明確請求快取的數據(使用 wp_cache_xxx() API 函數)。
儘管這意味著性能會比使用 WP Super Cache 等外掛差一些,但您的所有頁面依然保持動態。
如果您正在使用的外掛或主題沒有使用 WordPress 快取 API,則 WP File Cache 將無法幫助您。這是有意設計的,因為這個外掛試圖友好地運作。但是,對於大多數 WordPress 安裝來說,這將不是關鍵性問題。

WP File Cache 顯著降低了您數據庫的負載。例如,我的博客首頁,在啟用該外掛之前執行的 24 次查詢(0.02403 秒),但啟用之後只有 4 次查詢(0.00188 秒)。
與 DB Cache/DB Cache Reloaded 不同,該外掛將在管理面板中運作,並支援所有使用 WordPress 快取 API 的插件。

請注意,WP File Cache 將負載從您的數據庫轉移到您的磁盤/文件系統上,如果磁盤 I/O 是瓶頸,基於文件的快取將對您沒有幫助。

為了獲得最大的快取性能,請在您的 php.ini 中禁用 open_basedir — 它會使事情變得非常慢。

警告:啟用 PHP 安全模式且 Web 服務器由不同的用戶擁有檔案時,該插件可能無法運作。

wp-config.php 靈幻常數

有一個靈幻常數,WP_FILE_CACHE_LOW_RAM。當 ini_get('memory_limit') - memory_get_usage() 小於 WP_FILE_CACHE_LOW_RAM 時,快取會部分停用。
這意味著仍然會使用內存快取中可用的數據,但不會從文件中讀取。當您在 class.FileCache.php 中遇到記憶體不足出錯時,這可以很有用。

默認情況下,此功能已關閉,但您可以使用以下定義啟用它:

define('WP_FILE_CACHE_LOW_RAM', '4M');

將 4M 替換為您的值。

停用/刪除

請確保網頁伺服器可以寫入 wp-content 目錄:這個外掛需要刪除其中的 object-cache.php。
通過 WordPress 的「插件」選單停用/卸載外掛。
請驗證 wp-content/object-cache.php 檔案是否已被刪除。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.2.9.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「WP File Cache」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

The plugin implements object level persistent caching and can be used instead of the built in WordPress WP_Object_Cache.
Unlike WP Super Cache, Hyper Cache and other plugins, WP File Cache does not cache the entire page; instead, it caches the data WordPress explicitly asks it to cache (using wp_cache_xxx() API functions).
Although this means that the performance will be less than with, say, WP Super Cache, all your pages remain dynamic.
WP File Cache won’t help you much if the plugins or theme you are using do not use WordPress Cache API. This is by design, since the plugin tries to play nice. However, for most WordPress installations this will not be critical.
WP File Cache significantly reduces the load from your database. Say, my blog’s home page without the plugin executes 24 queries (0.02403 sec); with the plugin enabled, only 4 queries (0.00188 sec).
Unlike DB Cache/DB Cache Reloaded, the plugin will work in the Admin Panel and supports all plugins that use WordPress Cache API.
Please note that WP File Cache shifts the load from your database to your disk/file system and if Disk I/O is a bottleneck, file based caches will not help you.
To get the maximum cache performance, please disable open_basedir in your php.ini — it really slows the things down.
WARNING: chances are that the plugin will not work when PHP safe mode is enabled and web server is operated by a different user than owns the files.
wp-config.php Magic Constants
There is one magic constant, WP_FILE_CACHE_LOW_RAM. When ini_get('memory_limit') - memory_get_usage() becomes less than WP_FILE_CACHE_LOW_RAM, caching gets partially disabled.
This means that the data that are available in the memory cache will still be used but no reads from the files will be performed. This can be useful when you get Out of Memory errors in class.FileCache.php.
By default this feature is turned off but you can enable it with defining
define('WP_FILE_CACHE_LOW_RAM', '4M');

Repleace 4M with your value.
Deactivation/Removal

Please make sure that wp-content directory is writable by the web server: the plugin will need to delete object-cache.php from it.
Deactivate/uninstall the plugin through the ‘Plugins’ menu in WordPress.
Please verify that wp-content/object-cache.php file was removed.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon