
內容簡介
```html
<ul>
<li><strong>總結:</strong> VaryCache 是一個功能強大的 WordPress 快取外掛,將頁面快取和內容個性化結合在一起。您可以根據 A/B 測試、訪客位置或 URL 參數提供不同版本的快取頁面,同時保持極佳的效能。</li>
</ul>
<ul>
<li><strong>問題:</strong> VaryCache 可以根據哪些條件提供不同版本的頁面快取?</li>
<li><strong>答案:</strong> 透過 A/B 測試、訪客位置,或 URL 參數。</li>
</ul>
<ul>
<li><strong>問題:</strong> VaryCache 提供哪些核心快取功能?</li>
<li><strong>答案:</strong>
<ul>
<li>Page Cache - 基於文件的快取,快速提供頁面,無需使用資料庫</li>
<li>REST API Cache - 快取 REST API 回應,減少伺服器負載</li>
<li>Cache Preload - 從站點地圖自動預熱快取</li>
<li>Browser Cache Headers - 快取控制、到期時間、最後修改時間、異動標頭</li>
</ul>
</li>
</ul>
<ul>
<li><strong>問題:</strong> VaryCache 的內容個性化功能有哪些?</li>
<li><strong>答案:</strong>
<ul>
<li>A/B Testing - 創建多個測試及其權重變化(50/50、70/30 等)</li>
<li>Geo Targeting - 根據訪客國家/地區顯示不同內容</li>
<li>Query Parameters - 根據 UTM 標籤和其他 URL 參數快取變化</li>
</ul>
</li>
</ul>
<ul>
<li><strong>問題:</strong> VaryCache 提供哪些速度優化功能?</li>
<li><strong>答案:</strong>
<ul>
<li>HTML Minification - 移除空格以減少頁面大小</li>
<li>DNS Prefetch - 預先解析外部域名以加快載入速度</li>
<li>Preload Resources - 預先載入字型、CSS 和主要圖像以改善 LCP</li>
<li>Link Prefetch - 懸停時預先載入頁面以實現即時導覽</li>
<li>Disable Emoji - 移除 WordPress 表情符號腳本(省下約 15KB)</li>
<li>Remove Query Strings - 更好的 CDN 快取靜態資源</li>
<li>Image Dimensions - 自動添加丟失的寬度/高度以防止 CLS</li>
</ul>
</li>
</ul>
<ul>
<li><strong>問題:</strong> VaryCache 具備哪些開發者功能?</li>
<li><strong>答案:</strong>
<ul>
<li>Shortcodes - 在文章和頁面中輕鬆切換內容</li>
<li>PHP 函數 - 供主題開發者使用的輔助功能</li>
<li>Debug Panel - 前端的視覺化調試面板</li>
<li>CDN Compatible - 與 CloudFront、Cloudflare 和其他 CDN 兼容</li>
<li>Translation Ready - 包含俄語翻譯</li>
</ul>
</li>
</ul>
```
外掛標籤
開發者團隊
原文外掛簡介
VaryCache is a powerful WordPress caching plugin that combines page caching with content personalization. Serve different cached versions of your pages based on A/B tests, visitor location, or URL parameters — all while maintaining excellent performance.
Core Caching
Page Cache – File-based caching for fast page delivery without database overhead
REST API Cache – Cache REST API responses to reduce server load
Cache Preload – Automatic cache warming from sitemap
Browser Cache Headers – Cache-Control, Expires, Last-Modified, Vary headers
Content Personalization
A/B Testing – Create multiple tests with weighted variants (50/50, 70/30, etc.)
Geo Targeting – Show different content based on visitor’s country
Query Parameters – Cache variations based on UTM tags and other URL parameters
Speed Optimizations
HTML Minification – Remove whitespace to reduce page size
DNS Prefetch – Pre-resolve external domains for faster loading
Preload Resources – Preload fonts, CSS, and hero images for better LCP
Link Prefetch – Preload pages on hover for instant navigation
Disable Emoji – Remove WordPress emoji scripts (~15KB savings)
Remove Query Strings – Better CDN caching for static resources
Image Dimensions – Auto-add missing width/height to prevent CLS
Gzip Compression – Compress HTML output to reduce page size by ~70%
Developer Features
Shortcodes – Easy content switching in posts and pages
PHP Functions – Helper functions for theme developers
Debug Panel – Visual debugging panel on frontend
CDN Compatible – Works with CloudFront, Cloudflare, and other CDNs
Translation Ready – Includes Russian translation
Shortcodes
[varycache_ab v="A"]Content for variant A[/varycache_ab]
[varycache_ab v="B"]Content for variant B[/varycache_ab]
[varycache_ab test="pricing" v="X"]Content for specific test[/varycache_ab]
[varycache_geo country="US"]Content for US visitors[/varycache_geo]
PHP Functions
// A/B Testing
if ( varycache_is_variant( 'A' ) ) {
// Show variant A content
}
$variant = varycache_get_variant(); // Returns 'A', 'B', etc.
// Geo Targeting
if ( varycache_is_geo( 'US' ) ) {
// Show US-specific content
}
$country = varycache_get_geo(); // Returns 'US', 'RU', etc.
Page Patterns
Flexible page matching with wildcards and regex:
/ – Homepage only
/pricing – Exact page match
/blog/* – Single level wildcard
/shop/** – Any depth wildcard
~^/post/\d+$ – Regular expression (prefix with ~)
Requirements
WordPress 5.0 or higher
PHP 7.4 or higher
Write access to wp-content directory
