We’ve written a lot about server-side caching at NameHero. It allows your website to keep copies of generated pages and serve them to visitors without needing to recreate them over and over. Better speeds for your visitors and easier server loads on your end. What’s not to like?
However, caching has traditionally been useful only on largely static pages. And since WordPress was originally designed as a blogging platform, most caching solutions work on the assumption that content won’t change too often. However, WordPress has now gone far beyond its roots and is used to create all kinds of websites, both static and dynamic.
And when it comes to dynamic pages, caching becomes a lot less effective and can even negatively impact your page times. WooCommerce is one example of this.
WooCommerce and Server Caching
WooCommerce pages can have a lot of dynamic content in two ways:
- Data-driven changes – inventory stock, prices, discounts etc
- User drive changes – cart counts, user names, credit card numbers etc
All this makes it very difficult to cache WooCommerce pages. How do you create a copy of a page when the data is constantly changing? Every time a user logs in and you show them their “recently viewed” items or payment information, that is user-specific content and cannot be cached.
So there’s no option but to generate these pages from scratch. And the load adds up. Ordinary caching allows your website to scale efficiently because the workload of the server only needs to be done once for any given page. But WooCommerce websites behave in an entirely different manner.
Now the scaling is linear. The more people that use your site, the more your server load increases. And caching doesn’t seem to help much.
Or does it?
Trying to Cache WooCommerce Pages
There have been a lot of attempts to improve caching for WooCommerce pages, so as to reduce the server load when traffic to dynamic pages increases. The leading technology on this front is called “Edge Side Includes” or ESI.
ESI means you try and cache whatever you can – and only dynamically generate specific content that changes with each page load. As expected, most content – even on WooCommerce pages – doesn’t change. The majority of the HTML, inline scripts, JSON, content and descriptions etc should all remain static even if multiple different users view a user-specific page.
ESI attempts to tag these sections and generates them separately from the main page. This allows a sort of caching “in-between” system where it’s obviously not as fast as a fully cached page, but still much faster than it would have been without it.
NameHero’s LiteSpeed Includes ESI
One of the benefits of using LiteSpeed servers with NameHero, is full ESI integration with WooCommerce. The WooCommerce plugin itself designates which sections of the page are amenable to ESI processing, and the LiteSpeed caching system takes that into consideration while generating the page.
Most WordPress caching plugins don’t include ESI, and some require a paid subscription to enable it. With NameHero, LiteSpeed provides advanced ESI caching for free, regardless of which plan you choose. This makes NameHero one of the best web hosts for WooCommerce hosting.
Sometimes It’s Better to Avoid Caching
It’s easy to get too carried away with ESI. Sometimes when most (or all) of the page is dynamic and constantly changing, it’s easier to just generate the page from scratch without bothering about ESI. One example is forum software, where user-generated content rules. In such a situation, attempting to cache the page simply increases the overload more than it’s worth.
WooCommerce requires special caching systems to deal with the specific parts of a page that are dynamic in nature. This can be addressed with Edge Side Includes. The LiteSpeed web server that comes free with NameHero enables this functionality, making it one of the most efficient web hosts for WooCommerce hosting.
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!