[WordPress] 外掛分享: SQLite Object Cache

WordPress 外掛 SQLite Object Cache 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「SQLite Object Cache」是 2022-12-05 上架。
  • 目前有 6000 個安裝啟用數。
  • 上一次更新是 2025-04-17,距離現在已有 17 天。
  • 外掛最低要求 WordPress 5.5 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 5.6 以上。
  • 有 39 人給過評分。
  • 論壇上目前有 6 個提問,問題解答率 100% ,不低,算是個很有心解決問題的開發者團隊了!

外掛協作開發者

olliejones |

外掛標籤

apcu | cache | SQLite | performance | object cache |

內容簡介

持久化物件快取 可以提升您的網站效能。這個外掛使用了廣泛應用的 SQLite3 擴充套件。許多託管服務都提供了它。如果您的託管服務沒有提供 memcached 或 redis,您可以使用這個外掛取而代之,享受物件快取的好處。

快取 在電腦領域中隨處可見,WordPress 也有自己的快取子系統。快取包含昂貴的資料庫查詢或是計算的短期結果拷貝,軟體可以使用這個拷貝而不是重複昂貴的操作。這個外掛(像其他物件快取外掛)擴展了 WordPress 的快取子系統,把這些短期拷貝從頁面視圖保存到下一個頁面視圖。WordPress 的快取恰巧是一個 memoization 快取。

沒有持久化的物件快取,每次 WordPress 的頁面視圖都必須使用 MariDB 或 MySQL 資料庫伺服器來檢索您網站的所有內容。當使用者請求頁面時,WordPress 將從頭開始,從您的資料庫伺服器載入所有它需要的東西。只有這樣它才能向使用者提供內容。有了持久化的物件快取,WordPress 立即載入它需要的大部分資訊。這減輕了資料庫伺服器的負擔並更快地向使用者提供內容。

感謝 Till Krüss。他的 Redis Object Cache 外掛成為了這個外掛的範本。還有,感謝 Ari Stathopoulos 和 Jonny Harris 審查過這個外掛。 (當然,所有的缺陷都是作者負責的。)

原文外掛簡介

A persistent object cache helps your site perform well. This one uses the widely available SQLite3 extension, and optionally the igbinary and APCu extensions to php. Many hosting services offer those extensions, and they are easy to install on a server you control.
What is this about?
It’s about making your site’s web server perform better. An object cache does that by reducing the workload on your MariaDB or MySQL database. This is not a page cache; these persistent objects go into a different kind of cache. These objects aren’t chunks of web pages ready for people to view in their browsers, they are data objects for use by the WordPress software.
Caches are ubiquitous in computing, and WordPress has its own caching subsystem. Caches contain short-term copies of the results of expensive database lookups or computations, and allow software to use the copy rather than repeating the expensive operation. This plugin (like other object-caching plugins) extends WordPress’s caching subsystem to save those short-term copies from page view to page view. WordPress’s cache happens to be a memoization cache.
Without a persistent object cache, every WordPress page view must use your MariaDB or MySQL database server to retrieve everything about your site. When a user requests a page, WordPress starts from scratch and loads everything it needs from your database server. Only then can it deliver content to your user. With a persistent object cache, WordPress immediately loads much of the information it needs. This lightens the load on your database server and delivers content to your users faster.
Who should use this?
If your site runs on a single web server machine, and that server provides the SQLite3 and igbinary extensions to php, this plugin will almost certainly make your site work faster. And if that server provides the APCu extension, this plugin uses it too.
Some hosting providers offer redis cache servers. If your provider offers redis, it may be a good choice. You can use it via the Redis Object Cache plugin. Sites using redis have one SQL database and another non-SQL storage server: redis. Other hosting providers offer memcached, which has the Memcached Object Cache plugin. And some large multipurpose cache plugins, such as the LiteSpeed Cache, also offer object caching based on one of those cache server software packages.
The cache-server approach to object caching comes into its own when you have multiple load-balanced web server machines handling your site. SQLite doesn’t work correctly in a multiple-web-server environment.
But, for single-server site configurations, SQLite, possibly assisted by APCu, performs well. And the vast majority of sites are single-server.
APCu
APCu is an in-memory storage medium. It lets php programs, like WordPress, store data in shared memory so it’s very fast to retrieve when needed. If APCu is available on your host server, you can configure this plugin to use it. It reduces the typical cache lookup time to one-fifth or less of the SQLite lookup time, which is itself a few tens of microseconds. Performance counts, especially on busy web sites.
Please look at Installation to learn how to configure this plugin to use APCu. The plugin works fast without it, and faster with it.
WP-CLI: Even if APCu is in use, caching with SQLite is necessary when your web site uses WP-CLI, because WP-CLI programs do not have acces to the APCu cache. This plugin writes all cached data both to APCu and to SQLite and makes sure the two are synchronized.
WP-CLI
You can control this plugin via WP-CLI once you activate it. Please type this command into your shell for details.
wp help sqlite-object-cache

Credits
Thanks to Till Krüss. His Redis Object Cache plugin serves as a model for this one. And thanks to Ari Stathopoulos and Jonny Harris for reviewing this. Props to Matt Jones for finding and fixing a bug that appeared on a heavily loaded system. Thanks to Massimo Villa for testing help, and to nickchomey for a comprehensive code review. All defects are, of course, entirely the author’s responsibility.
And thanks to Jetbrains for the use of their software development tools, especially PhpStorm. It’s hard to imagine how a plugin like this one could be developed without PhpStorm’s tools for exploring epic code bases like WordPress’s.
How can I learn more about making my WordPress site more efficient?
We offer several plugins to help with your site’s database efficiency. You can read about them here.

各版本下載點

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

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


0.1.7 | 1.0.0 | 1.1.0 | 1.1.1 | 1.2.0 | 1.2.1 | 1.2.2 | 1.2.3 | 1.3.0 | 1.3.1 | 1.3.2 | 1.3.4 | 1.3.5 | 1.3.6 | 1.3.7 | 1.3.8 | 1.4.0 | 1.4.1 | 1.5.1 | 1.5.4 | 1.5.5 | 1.5.6 | trunk |

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

  • APCu Manager 》在 WordPress 管理員儀表板中準確地管理 APCu 統計信息。, APCu 管理器是一個功能完整的 APCu 管理和分析報告工具。它使您能夠監視和優化 WordPress 網站或網...。
  • atec Cache Info 》簡介:此外掛提供 PHP 快取功能的基本統計數據,包括 OPcache、WP-object-cache、APCu、Memcached、Redis 和 SQLite-object-cache。, , 問題與答案:, , 問題...。
  • APC Clear Cache 》APCu/APC 是一個免費的、開源的 PHP 語言的操作碼快取外掛。如果您的主機已經安裝了 APC/APCu 快取,這個外掛可以讓您在 WordPress 中清除快取。安裝後,進入...。
  • Easy Object Cache 》Easy Object Cache是一個簡單而高效的外掛程式,設計用於執行兩項任務:, , 根據您的設定,產生並設置所謂的「drop-in」擴充套件,命名為object-cache.php。,...。
  • WP LCache 》對於關注高流量、已登入使用者速度或動態頁面加載的網站來說,高速和持久的物件快取是必須的。 WP LCache 通過使用 APCu、PHP 的內存快取來改進 Memcached 和...。

文章
Filter
Apply Filters
Mastodon