General Settings in W3 Total Cache (Part 2)

​In the first part we talked about several settings of the Page Cache module in the W3 Total Cache plugin. These are the settings which you have to pay attention to. Now we will describe the remaining caching types in this plugin.

As Object Cache and Database Cache will work with default settings, you may only enable them. We will emphasize on Minify Settings as they are often the reason for incorrect site visualization.

Database Cache

The Database Cache module caches the results of the most frequent SQL queries to the database. Multiple SQL queries may be executed when a page of the website is being accessed. The number of queries may increase depending on the theme and the plugins on the website.

Note: If you experience a slowdown in website loading, deactivate the Database Caching.

Database Cache Settings

Settings in Database Cache you have to pay attention to

Don’t cache queries for logged in users

Enable the Don’t cache queries for logged in users option in General, if your website bandwidth comes mainly by anonymous users (users who are not logged in). If the bandwidth comes mostly by logged in users, then you may leave this option disabled.

Object Cache

The Object Cache module uses a WP_Object_Cache WordPress’ class for caching objects. These objects are used by the specific installation, such as:

  • last comments;
  • last posts (sample objects options:alloptions, posts:category, themes, users, comment:last_changed, comment:get_comments, widget:widget_recent_posts, etc.).

Note: If you experience a slowdown in website loading, deactivate the Object Caching.

Minify

Minify is a technique to reduce text file size, in this case: .css and .js. Size reduction is achieved by removing unnecessary characters and white space characters in the file, contents compression.

Along with minification the plugin also performs combination of multiple files into one. The contents of all .css files is combined into one .css file. .js files are also combined the same way.

Note: Not all .css and .js files are subject to combination and minification.

Minify Settings

Settings in Minify you have to pay attention to

If you have enabled Disk as a caching method, you will be able to check the reduced .css and .js files. They will be generated in the /wp-content/cache/minify directory of the hosting account.

After you finish Minify settings completely, you will always be able to switch to caching technology: Redis/Memcached.

When you enable Minify through General Settings, you will be able to select the following Minify mode: Auto or Manual. In case after you have selected Auto, you notice incorrect loading of page style, switch to Manual mode.

Since there is a great variety of themes and plugins for WordPress, the Minify settings may differ for each theme and plugin. With the manual mode option of Minify you may test with various setup options, so as to avoid incorrect visualization of site style.

In settings page select Performance » Minify enable Minify for HTML & XML, JS and CSS.

Rewrite URL structure option

It is recommended that the Rewrite URL structure option in General for resource URL address rewriting is enabled. If the option is enabled URL address of the embedded .css and .js resources to the page will be without any variables. And instead of:

/wp-content/plugins/w3-total-cache/pub/minify.php?file=60eac/default.include.2d9d50.css

it will be:

/wp-content/cache/minify/000000/60eac/default.include.2d9d50.css

HTML & XML

From the options in HTML minify settings check these: Inline CSS minification and Inline JS minification. They will minify CSS and JavaScript code, that is available directly in the source code (and not in a separate file).

JS

In the JS minify settings there are options for JavaScript code processing, that are applied to the respective areas of HTML document:

  • Before /head (before the closing tag /head);
  • After body (after opening body tag );
  • Before /body (before the closing /body tag).

Minify – .js file minification and combination will also be applied;

Combine only – .js file combination will only be applied (without code minification);

Embed type: Several manners to embed .js code, blocking (Default) or non-blocking. The type of .js embedding is very important for correct visualization. At first test with Non-blocking using “async” and in case of incorrect loading, try with each of the remaining types.

In JS file management you may select .js files of the theme that will be minified and combined. For each .js file you may select the position in the HTML document, where it will be embedded – after the head tag, after body or before /body tag. Depending on the theme and if you are not sure where exactly to embed the .js code without any problems, test various positions.

CSS

As with the .js files in this section in CSS file management add all .css files you would like to minify. The .js and .css files may be arranged by drag and drop.

Minify wizard: If you do not know which theme .css and .js files and plugins are used, take a look at the top of the page containing Minify settings and from the Get minify hints using the wizard sentence click Help. Minify wizard will automatically display all .css and .js files of the theme and plugins. After you check all or only certain files, you may add them automatically by Apply & close.

Minify setting testing: After each change to settings, clear the cached information on Page Cache and Minify Cache modules. Then reload several pages to re-generate a new cache and to see the results of the changes.

Browser Cache

Browser Cache is used for keeping site information locally from user’s web browser. Web browser stores information such as images, scripts, pages, animations, etc. for faster website loading. This stored information is a copy of the original site information and is stored locally on the computer hard disk.

Browser Cache Settings

Settings in Browser Cache you have to pay attention to.

The recommended options which you may enable for all CSS, JS, HTML elements, images, etc. are Set Last-Modified header, Set expires header, Set entity tag (eTag) and Enable HTTP (gzip) compression.

To use gzip compression, at first you have to enable the mod_deflate module in cPanel from the “Optimize Website” menu. (Note: The mod_deflate module is offered with the SuperPro and SuperHosting plans.)

Cached information statistics by modules

Information on cached elements may be displayed by enabling the Debug Mode option in the General Settings. To see information on all modules, check Page cache, Minify, Database Cache and Object Cache. After you save the settings, reload a page and take a look at its source code. A list of all cached elements will appear in the code at the bottom as a HTML comment.

Tip from the Support: It is recommended for the tests with this plugin settings not to be performed directly on the site, but on its draft copy.
You may enable the caching types one by one by testing whether the website runs properly after each change.

Trick from the Support: To display cached elements, SQL queries, Object Cache data and ready HTML pages, you may select Disk caching for all modules. Then access the hosting account and look up in the following directory: /wp-content/cache/. For each cashing type there is a separate directory (db, minify, object, page), in which cached data is stored, saved in files. You may see cached data in each file. After viewing cached data, switch back to Redis/Memcached.

Important: When Disk caching is used for Page Cache, Object Cache and Database Cache, a large number of inodes (files and directories) will be created in the cache directory. Depending on plugin settings this number may increase quickly and constantly. The selection of cache by means of Redis/Memcached is recommended for these three cashing types.

See the first part: 🔗 General Settings for W3 Total Cache (Part 1) | Blog

Madlena Metodieva
Madlena Metodieva
Madlena is our super-support-guru. Madlena's SuperPower is that she can explain even the most complicated technologies in plain language.
0 0 votes
.
Subscribe
Notify of
guest

2 Comments
Inline Feedbacks
View all comments