
內容簡介
NiroCache 透過將每個頁面儲存為靜態 HTML 檔案,讓您的網站加速,並在 WordPress 加載之前即提供該檔案給訪客。啟用後即刻生效,無需繁瑣設定,確保安全且高效的預設值。
【主要功能】
• 靜態 HTML 頁面快取,於 WordPress 加載前提供
• 智能清除:更新文章自動清除相關頁面
• 站點範圍清除,更新佈景主題或設定時自動執行
• 預設安全,不會快取登入用戶及特定頁面
• 支援追蹤參數,避免重複快取頁面
• 一鍵快取測試,確認頁面是否正確快取
外掛標籤
開發者團隊
原文外掛簡介
NiroCache makes your site faster by saving each page as a static HTML file and serving that file to visitors before WordPress even loads. Pages that took hundreds of milliseconds to build are delivered in a few.
It works the moment you activate it. There are no presets to study and no settings you have to change: sensible, safe defaults are already in place.
How it works
The first visitor to a page gets it generated by WordPress as usual. NiroCache saves a copy in wp-content/cache/nirocache/.
Every following visitor who is not logged in gets that copy straight from the early-cache file, skipping PHP templates and database queries.
When you update content, NiroCache clears exactly the pages that show it, so visitors never see outdated content.
Features
Static HTML page cache served before WordPress loads.
Smart purging: updating a post clears the post, the home page, its category and tag archives, its author archive and its post type archive. Approved comments and WooCommerce stock changes clear the affected product or post.
Site-wide purging after theme, menu, widget, Customizer, Site Editor, permalink and general settings changes.
Safe by default. These are never cached: logged-in users, commenters, carts, checkout and account pages, search results, previews, password-protected content, 404 pages, feeds, REST API, AJAX and form submissions. Pages that set DONOTCACHEPAGE or send Cache-Control: no-cache, no-store or private are respected.
Tracking parameters such as utm_source, gclid and fbclid share the page’s cached copy instead of creating new ones.
Exclusions: never cache chosen URLs (with * wildcards), visitors carrying chosen cookies, or single pages ticked “Don’t cache this page” in the editor.
One-click cache test that confirms pages are stored and served, or tells you exactly why they are not.
Detects other active page cache plugins and warns about running two page caches at once.
Clear the cache from the admin toolbar, the settings screen, or the post editor.
Configurable cache lifespan, plus a daily cleanup of expired pages.
Optional debug headers (X-Niro-Cache: HIT, MISS or BYPASS) for troubleshooting.
Multisite compatible: each site’s cache is kept separate.
No external services, no tracking, no ads.
What NiroCache changes on your site
Page caching in WordPress needs two things outside the plugin folder. NiroCache sets them up for you and removes only what it added:
wp-content/advanced-cache.php: the standard WordPress early-cache file, copied from the plugin. It is only created if no other plugin owns it, and it is removed when you deactivate NiroCache.
define( 'WP_CACHE', true ); in wp-config.php: added only if WP_CACHE is not already defined, and removed when you deactivate NiroCache. If wp-config.php is not writable, the settings screen tells you which line to add.
Cached pages are stored in wp-content/cache/nirocache/. That directory holds data only: rendered HTML, a small JSON settings file per site, and empty marker files. NiroCache reads them as data and never executes anything it writes there. They are deleted when you deactivate the plugin, and the whole directory is removed when you delete the plugin.
Privacy
NiroCache does not collect or send any data. The cache test makes two requests from your server to your own home page and nowhere else. Cached copies only ever contain pages as seen by visitors who are not logged in.
For developers
Filters:
nirocache_should_cache — return false to keep a rendered page dynamic.
nirocache_excluded_urls — URL path patterns that are never cached.
nirocache_bypass_cookies — cookie name prefixes that make a visitor bypass the cache.
nirocache_ignored_query_params — query parameters that share the cached copy.
nirocache_post_purge_urls — URLs cleared when a post changes.
nirocache_site_wide_post_types — post types whose changes clear the whole cache.
nirocache_conflicting_plugins — page cache plugins to warn about.
nirocache_dropin_path and nirocache_wp_config_path — file locations NiroCache manages.
Actions:
nirocache_cache_created — a page was stored.
nirocache_url_purged — a URL’s cached copies were cleared.
nirocache_cache_purged — the whole cache was cleared.
nirocache_exclusions_changed — a page was ticked or unticked “Don’t cache this page”.
Set the NIROCACHE_CACHE_DIR constant in wp-config.php to store cached pages somewhere else.
