1. Code
  2. WordPress

Configuring W3 Total Cache: Advance Database Cache

This post is part of a series called Configuring W3 Total Cache.
Configuring W3 Total Cache: Advanced Minification Settings

So far we have configured W3 Total Cache Minification settings. In this tutorial, I'll be covering the advance configurations for W3 Total Cache.

Database Cache

The database cache is an important factor to optimize your site. Let me give you an example of three tiered network: Now-a-days, applications are being deployed at a multi-tier scale to improve the performance. This means that there is the application tier and data tier can be present on different hosts. On demand, the application displays the data.

Here, the bottleneck is the data tier. A bottleneck is defined as a point where the performance or capacity of an entire system is limited by a number of components or resources. In our case, this will be the data tier. 

To improve the performance, it is clear that we need data right where the application tier is present, but the commercial databases are heavy enough to be put with application tier, so we use other light databases to cache the data in the application tier host. 

To clarify the above description, think of it this way: The easy way of getting to know this type of cache, will be considering that in your WordPress website where pages are being served dynamically by querying your database again and again. What the database cache does is it caches the most commonly used queries so that more static content can be quickly retrieved.

Advantages of Database Caching

  • Scalability
  • Flexibility
  • Availability
  • Performance
Advance Database Cache


Let's start configuring the database cache. First, notice the "General" tab. Check the option that tells the plugin not to cache queries for users who are logged in. If you are using WordPress as a CMS and selling paid content, for example, where all of the traffic you have is a set to logged in users, then you can uncheck this option.



Maximum Lifetime of Cache Objects

In the advanced settings, the first configuration is set to the value of 180 seconds. It determines the expiration time of unchanged cache items. The higher the value, the larger the cache. If you want to cache your database queries for more time you can increase the value. It will dramatically increase the cache size in the disk.


Garbage Collection Interval

This setting defines how often you want to remove the garbage cache from your disk. In the earlier tutorials, we selected "Disk Type Caching" which is responsible for saving the cache in your host's disk storage. The garbage collection interval setting is responsible for how often should the wasted cache should be deleted. It's default value 3600 and is just fine in most situations.

Garbage Collection

Never Cache the Following Pages

The pages/URLs or directories defined in this box will not be cached. This setting helps us when we have some trouble with a particular page or something directory relevant to a plugin.

Uncached Pages

Ignored Query Stems

Sometimes plugins like WooCommerce and other rating plugins are disturbed because of the database cache. We tend to ignore the database queries relevant to these plugins through this area. WooCommerce and other most used plugins are already addressed. That is, you can see some default values that are already set.

For example, I had issues with the Rating plugin, so I consulted Lester (the author of this very plugin), he told me to ignore these two stems wp_postmeta and wp_ratings in W3TC. This example is just to give you the heads up about how you can get the issues resolved. 

Note that any entered prefix (set in wp-config.php) will be replaced with current database prefix (default: wp_). Query stems can be identified using debug mode. If you still get to have any issue you can read this solution.

Ignored Query Stems

Reject Query Words

Leave this setting alone unless you are a database administrator and you know what you are doing. This area is used to ignore certain patterns of database queries which are too important to be used first-hand instead of being cached.

Rejected Query Words

That's about it. We'll cover the object cache in the next tutorial. If you have any questions, I'll be happy to help you.

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.