通过W3 Total Cache中的高级配置增强数据库缓存。

Wordpress8个月前发布 SUYEONE
1.6K 0 0

So far, we’ve configured the basic caching settings in W3 Total Cache. In this tutorial, I’ll delve into the advanced configuration of this plugin, focusing on Database caching, which plays a crucial role in Website optimization.

Imagine a three-tier network scenario where applications are distributed across layers to enhance performance. This means the application layer and data layer can reside on separate servers. The application retrieves data as needed, and the bottleneck here refers to the layer that limits the overall system’s performance or capacity – in our case, the data layer.

To boost efficiency, the idea is to have data cached closer to the application layer. However, commercial databases can be too heavy for this purpose. Therefore, Lightweight databases are used to cache data on the host running the application layer. Simply put, database caching works by storing frequently used queries, allowing static content to be retrieved more swiftly, instead of dynamically querying the database for each WordPress page load.

Benefits of Database Caching:
1. Scalability
2. Flexibility
3. AvAIlability
4. Performance

Let’s proceed with configuring the database caching. On the General tab, you’ll find an option to exclude logged-in user queries from caching. If your WordPress site primarily serves logged-in users (like a CMS with paid content), you might want to disable this option.

In the Advanced settings, the ‘Longest object cache lifetime’ is initially set to 180 seconds, determining how long unchanged cache items remain valid. Increasing this value extends caching duration, potentially significantly increasing disk cache size.

The ‘Garbage collection interval’ defines how often obsolete cache is rEMOved from the disk, especially relevant since we chose ‘Disk-based caching’ earlier, which stores cache on the host’s disk storage. The default value of 3600 seconds usually suffices.

‘Do not cache pages’ allows you to specify pages/URLs or directories that should bypass caching. This setting comes in handy when troubleshooting issues with specific plugin-related pages or directories.

Under ‘Ignored query stems,’ you can exclude queries related to problematic plugins, like WooCommerce, from caching. Common plugins like WooCommerce have predefined values here. For instance, if you encounter issues with a rating plugin, consulting its author (in this case, Lester) might reveal query stems like ‘wp_postmeta’ and ‘wp_ratings’ to ignore in W3TC. Note that any custom prefixes set in wp-config.php will be replaced by the default prefix (‘wp_’).

The ‘Blacklist query terms’ section is typically for database administrators who understand the implications. It’s used to exclude certain query patterns that are too critical to be cached. Unless you’re well-versed in this area, it’s best left untouched.

That concludes the discussion on database caching. Our next tutorial will cover object caching. If you have any questions, feel free to ask.

© 版权声明

相关文章

暂无评论

暂无评论...
☺一键登录开启个人书签等功能!