Linux 软件免费装
Banner图

VaryCache

开发者 gkap186
更新时间 2026年1月10日 20:09
PHP版本: 7.4 及以上
WordPress版本: 6.9
版权: GPLv2 or later
版权网址: 版权信息

标签

cache performance a/b testing personalization geo targeting

下载

1.2.4 1.2.5 1.2.7 1.2.0 1.2.3 1.2.1 1.2.2

详情介绍:

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 Content Personalization Speed Optimizations Developer Features 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: Requirements

安装:

  1. Upload the varycache folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Go to Settings > VaryCache to configure
Quick Start
  1. Enable caching in the plugin settings
  2. Configure Page Cache to cache all pages or specific URLs
  3. Optionally set up A/B tests, geo targeting, or query parameters
  4. Use shortcodes in your content to show different versions to different visitors
Using with Other Cache Plugins If using another caching plugin, exclude pages with variant caching from that plugin's cache. VaryCache will handle caching for those pages with variant support.

升级注意事项:

1.2.3 New Gzip Compression feature reduces page size by ~70%. Enable in Speed tab for immediate performance boost. 1.2.0 New Speed tab with Core Web Vitals optimizations: HTML minification, DNS prefetch, preload hints, disable emoji, image dimensions. Highly recommended update for better performance. 1.1.0 New features: REST API caching, Cache Preload, Browser Cache Headers. Recommended update. 1.0.0 Initial release.

常见问题:

What makes VaryCache different from other caching plugins?

VaryCache combines page caching with content personalization. Unlike traditional caching plugins that serve the same cached page to everyone, VaryCache can serve different cached versions based on A/B tests, visitor location, or URL parameters.

Can I use VaryCache just for page caching without A/B testing?

Yes! You can use VaryCache purely as a page cache. Enable "General Page Cache" in the Page Cache tab and configure which pages to cache. A/B testing, geo targeting, and query parameters are optional features.

How does geo targeting detect the visitor's country?

VaryCache reads country information from HTTP headers provided by CDNs:

  • CloudFront: CloudFront-Viewer-Country
  • Cloudflare: CF-IPCountry
  • Custom: You can configure your own header name If no header is detected, the country code will be "XX".

Does this work with page builders like Elementor?

Yes! The shortcodes work with any page builder including Elementor, Gutenberg, Divi, WPBakery, and others. Simply add the shortcode blocks where needed.

How are visitors assigned to A/B test variants?

Visitors are randomly assigned based on the weights you configure (e.g., 50% variant A, 50% variant B). The assignment is stored in a cookie so they see the same variant on subsequent visits.

Does A/B testing affect SEO?

No. Search engine bots see the default variant, and the canonical URL remains unchanged. This is the recommended approach per Google's guidelines for A/B testing.

What are the speed optimization features?

VaryCache includes several Core Web Vitals optimizations:

  • HTML Minification - Reduces page size by removing whitespace
  • DNS Prefetch - Pre-resolves external domains (Google Fonts, Analytics, etc.)
  • Preload Resources - Preloads critical fonts, CSS, and hero images (improves LCP)
  • Disable Emoji - Removes WordPress emoji scripts (~15KB savings)
  • Image Dimensions - Adds missing width/height to prevent layout shifts (CLS)
  • Gzip Compression - Compresses HTML output to reduce page size by ~70%
  • Link Prefetch - Preloads pages when user hovers over links

How does REST API caching work?

You can configure specific REST API endpoints to be cached (e.g., /wp/v2/posts). Cached responses are served directly without executing PHP, significantly reducing server load for API-heavy sites.

Where are cache files stored?

Cache files are stored in wp-content/cache/varycache/. Settings are stored in wp-content/uploads/varycache/settings.json. Both locations are WordPress-compliant.

Can I clear the cache programmatically?

Yes, use VaryCache_Cache::clear_cache() in your code. The cache is also automatically cleared when posts are saved or deleted.

Does VaryCache work with CDNs?

Yes, but for A/B testing and geo targeting to work correctly, configure your CDN to:

  • Pass through cookies (for A/B test variant assignment)
  • Forward country headers (for geo targeting)

更新日志:

1.2.3 1.2.0 1.1.0 1.0.0