Welcome back to our channel or just welcome if you’re new here. Today’s video is about
WordPress caching. It is an essential part of improving your website’s performance, so I’ll
tell you everything there is to know about it. Also if you’re using a caching plugin, let us know
in the comments and we’ll tell you if it is good. Now, what is caching? It’s a process where you
store your website’s data in a fast-access memory and so you’re able to display it faster than if
you tried to load it all over again. For example, when your loyal customer visits your homepage for
the second time in one hour, they’re accessing the cached version of the page and that makes it
load much faster. Got it? Now let’s see how caching works under the hood.
Side note: If you’re looking to avoid any technical detail and instead arrive at the
optimal caching solution, use the timecode and learn about hosting-integrated caching.
While the principle of caching is pretty much the same across the board, there are many different
techniques to it. Since caching can be done in different stages of a web application,
each stage is called a cache layer. There’s Object Caching layer that’s enabled in WordPress
by default, then there’s Bytecode cache, Page Cache, and CDN cache. Let’s go through
each layer and discuss what it entails. Object caching is extremely common and
in WordPress, it is done by default. You see, WordPress database requests are heavy
and are cached through object cache. Almost every query is cached by WordPress and
the result is reused. The downside here is that it works only for the current request,
the cache is not shared between requests. If you use persistent cache storage, like Redis,
or Memcached, or APCu, the performance improvement will be much more tangible. I’ll put links to all
three caching systems in the description below. Then there’s Bytecode cache, a good way to
accelerate PHP code compilation 3 times. Here’s how it works: PHP code compiles into bytecode
which then executes in the PHP engine. The compiling process is slow, but we can speed it
up by saving compiled bytecode and reusing it for every request. Here’s a diagram for the process.
The downside of this cache layer is that if we change our PHP script, we have to clear the
bytecode cache. But then we don’t often change our code in production, do we? Plus, there are timers
that check for file changes and clear the cache. We won’t go into the details of installing
Bytecode on Ubuntu in this video, but if you click on the link in the description, you
can just follow the instructions in our blog post. The next caching layer is page cache, where you
can turn your dynamic WP site into a static website.. And static sites are, of course,
insanely fast. Basically, the idea is to cache the recently generated web page response from PHP-FPM
as a static HTML file with a specific cache key, like a URL, and serve that file from the
cache directory to all the visitors of your website, Rather than re run the PHP scripts
and MySQL queries to generate that web page. Can you do this with all sites, all web pages?
Nope, if your web page is very dynamic and non-consistent, like, say, an e-shop,
this cache layer won’t work. You’ll have to configure an exclusion for that page.
Okay, so how can you implement Nginx FastCGI Cache? Just follow the instructions listed in
our blog post in the description. There are too many technical nuances for us to go over here.
The final caching layer is CDN cache. But wait, what’s a CDN? The purpose of
CDNs is to speed up data travel and improve connectivity. To do this,
a CDN locates servers at the exchange points between different networks.
These so-called Internet exchange points (IXPs) serve as connection spots for different Internet
providers allowing them to give each other access to traffic originating from their different
networks. By having a connection to these high speed and highly interconnected locations,
a CDN provider is able to reduce costs and transit times in high speed data delivery.
Let’s take a look at the scheme. CDN caching is when a CDN caches
content in proxy servers located closer to end-users than origin servers.
The proximity of servers to users who make the requests is why a CDN delivers content faster.
So if we enable CDN Caching, if a client device makes a request for content it will
be served from the nearby server: A cache hit! And if CDN doesn’t have the copy of the
resource to serve and redirects the request to the original server, a cache miss occurs.
As a WordPress user, you’re probably thinking, “Okay, but can’t I just
use a plugin for all of this? There seems to be a plugin for everything else!” And yep,
you’re right, there are many caching plugins. Let’s go over the three most popular ones,
WP Rocket, W3 Total Cache, and WP Super Cache. WP Rocket is a pretty popular caching plugin.
It promises to drastically improve your site’s performance by cleaning up your database,
enabling cache preloading, and configuring your CDN. If you go with the $49 Single plan,
you’ll get 1 year of updates and can install the premium plugin on one website.
One year of updates and 3 websites will cost you $99.
The second caching plugin on our list is W3 Total Cache. It has been around for ages and promises to
make your website at least 10 times faster. Key features include caching of database objects,
pages, posts, feeds, and fragments, browser caching, minification of scripts, and
transparent CDN management. The premium version, Total Cache Pro, will cost you $99 per year.
Next up we have WP Super Cache. It offers sort of similar features to W3 Total Cache,
but has really simplified its user interface recently. Plus, this solution is more
straightforward and perfect for high-traffic sites. However, W3 Total Cache is more compatible
with all sorts of hosting providers. The good news is that WP Super Cache is completely free.
We get it, site owners and managers have too much on their plate already. They often don’t want to
know the technical details. If you’re one of those people who skipped to this section, no worries,
you can achieve the ultimate high PageSpeed score of 90+ for your website without any manual work.
Caching is included in 10Web’s automatic speed optimization service, so all you need to do
is sign up for the free 14-day trial, create a copy of your site hosted on 10Web automatically,
and check the performance improvement on both desktop and mobile. Link’s in the description.
Look, this is the old score of a site and this is the new score.
This massive performance boost will not only send your site to the top of Google search but also
boost your conversion rate, according to stats. So guys, this is all. Don't forget to like,
subscribe and comment the name of your caching plugin and share this video with
site owners and managers who are struggling to enhance their WordPress site's performance.
Take care and I'll see you in another video. This video was brought to you by 10Web an
automated WordPress platform designed for agencies. Automate hosting, speed optimization,
migration, site-building, and management, and skyrocket your agency growth. Sign up for a
14-day free trial, and experience true automation.