WordPress Caching

Real-world average WordPress website with modern complex and flexible theme is able to generate page response within 2-4 seconds. You are very happy website owner if your theme is able to generate it faster, and less happy one if slower.

Anyway keeping in mind that CSS, Javascripts and images should be loaded to show page content it ends up with 5 seconds full page loading time, which of course is not enough in our modern fast changing and fast moving world.
PageSpeed Insights for example require 200ms response time to be happy with your website.

That’s why effective caching is crucial for WordPress websites.
Most of the response time noted above it taken by PHP scripts executing this and that so that HTML will be generated in the end, and avoiding that will effectively eliminate most of time so that it ends up with 50-250ms on well configured web server, which is more than enough for most cases.

But as it usually happens in our world there is no silver bullet and caching has some limitations too.

First issue with it is that correct content has to invalidated at correct times and events. When you add new post to a blog website – your home page, author page, archive pages with appropriate year and/or month, feeds should be invalidated. Most WordPress plugins handle that perfectly so we suggest to use any, but unfortunately there are still hosting providers offering “blaze fast caching solutions” who don’t: it’s not invalidated at all or some pages are left cached, so you end up with old content at a part of your website.
Need to note here that even the best plugin may not know your theme specifics, so if you have some index page somewhere listing all your posts – it will not know that this page has to be invalidated and manual configuration adjustments are inevitable in this case.

Also you don’t want to cache all the pages you have. For example e-commerce normally don’t want to cache shopping cart page which is specific for each visitor, and it’s content is rather dynamic so that hit rate will low (mean caching is useless anyway).

More serious problems are dynamic parts of the page.
e-commerce websites show shopping cart content at each website, and news websites show unique ads for each visitor. In other words there are dynamic blocks on each page while most content is still static. We strictly suggest to keep your HTML static in that case so that whole page may still be cached and use AJAX techniques to load those remaining dynamic content. That offers you the best response time possible, and flexibility of dynamic content generation.
e-commerce plugins like WooCommerce already do that for you, and even more – store visitors shopping cart in a browser’s local storage. As a result shopping cart widget is displayed without any server-side operations.

While initial page content is still delivered very fast in this case, AJAX content is always dynamic, and other caching solutions should be used to provide top performance results. Database caching or WordPress-specific Object Caching is used in that case.
I want to stress that some knowledge required to configure it effectively and it rarely works out of the box.

Worst case scenario is a website with user-specific content. e-learning website is a good example of such, when different courses are displayed based on subscription level and whole logic is based on a list of passed / failed tests.
In that case only second-tier caching solutions may be used.
When page content has a lot of complex-to-generate but commonly used blocks – partial caching may be used sometimes as an errand to Database and Object caching solutions.

Our team is able to configure caching so that it will really work effectively for each specific website. There is a real difference in page loading time and server load when it works.