What is Caching?
When a request for a page or resource comes in to a server, it is compiled by the server and WordPress, which (especially with large amounts of traffic) can begin to put a strain on the server. Caching takes the request and stores a copied “snapshot” of it in a layer on the server instead, so that the next time it’s requested, it can just be served from the caching layer, rather than sending it all the way back to the server and WordPress to be compiled. This eases the strain a large amount of traffic can put on a server. This is the type of caching that WP Engine Page Cache™ uses to help improve the speed and scalability at which your pages are served.
By default the WP Engine Page Cache™ holds on to the content it stores for 10 minutes. This means every 10 minutes, the process of storing a new “snapshot” in the caching layer repeats itself.
What is Object Caching?
We also offer a layer of “object caching”, which caches the results of repeated queries to the database. For example, if you have a WordPress plugin for redirects on your website, the redirects would be stored in your database. Your website would then require that list of redirects to load every time a page is loaded, by running a query to the database. The server first looks for the list of redirects in the Object Caching layer. If it doesn’t exist yet, the query is run in the database, and then the result is stored in the Object Caching layer for the next time a page is loaded. To find out more about this type of caching, read our Object Caching article here.
What is Cacheability?
Cacheability is a percentage rating of how many of your site’s resources can be cached. Static files (files which rarely change) like CSS, JS, and images for example, are easily cacheable. Dynamic content like login pages, shopping carts, and membership-only areas are not cacheable because they require the screen to show something unique to each person visiting it. A “snapshot” of the page wouldn’t work in those cases, meaning those pages are “uncacheable”. Cacheability is simply the percentage of visits to your site that are cacheable, compared to those which are uncacheable.
A higher cacheability score indicates a faster site, better search rankings, and a lower bounce rate as a result (making for a better overall experience for visitors).
Isn’t Dynamic Content Good?
Yes and no – dynamic content is great in that it “personalizes” your site’s content to the specific visitor. However, generating this content new on every page load can be very taxing on the server, meaning your site won’t scale as well once you start receiving a lot of traffic. Sites that limit the amount of content that needs to be compiled new on the server every time will always present a faster, better experience for your visitors.
Creating Custom Content with Cache
We have created a unique option within our proprietary page caching system to allow developers to create page variations for different types of users, while still caching your pages. Learn more about how it works in our User Segmentation article!
One struggle developers have dealt with through the years is how to personalize content for different geographic regions, while maintaining the highest cacheability (and scalability). At WP Engine, we’ve come up with a solution for websites with worldwide markets: Our revolutionary GeoTarget system. This system allows you to serve different content to different areas of the world: by region, zip code, country, and more. And it also works within our caching system, by separating each area into its own “caching bucket.”
This means, for example, when a customer from Canada visits your site, they can view the custom content you’ve created for Canadian visitors, and stores a copy of this content in the “Canada” cache bucket. Then, the next visit from Canada can view a cached version of the site, which is served quickly and doesn’t need to be compiled by the server. And when a visitor from the USA visits the site, their content is stored in the “USA” cache bucket, for the next USA visitor to see the cache version of the page. The same would be true of any region with custom content you’ve created.
How Can I Improve Cacheability?
Now that you know why caching is important, you may be wondering: how can improve my website’s cacheability? In this section we will cover recommendations when hosting with WP Engine, as well as recommendations that can be used when hosting anywhere.
WP Engine-Specific Recommendations
At WP Engine, we offer Page Performance tools within your User Portal, which gives you a cacheability score for your site. It’s understandable that you might want to improve this score, considering all the benefits of caching! Below are a few ways you can increase your site’s cacheability, and with it, your site’s performance.
- Use a CDN: for Professional level plans and up, CDN through MaxCDN is available to be used. CDN stands for Content Delivery Network, and in short, it helps serve and cache your site’s static, cacheable content from multiple worldwide server locations. This helps improve performance for every area of the world, and not just the visitors closest geographically to your site’s server.
- Use GeoTarget: For Business level plans and up, GeoTarget through WP Engine is available. This is especially important for sites which want to display different content dynamically to visitors from different areas of the world. Rather than using a third-party plugin which generates uncached results for different locations, try using GeoTarget instead.
- Customize Page Variations within Caching: WP Engine allows for users to create multiple page variations to show to different types of users within its page caching system. Learn more about User Segmentation and how you can implement it.
- Increase Cache Expiration Time: You can configure pages to be cached for longer periods of time using the WP Engine Advanced Cache plugin. This will help ensure optimal cacheability and scalability on your site.
- Object Caching: Ensure you’re using our Object Caching layer, which comes free with every plan. You can enable Object Caching in your User Portal by navigating to the Overview page for your environment, then Utilities from the left-hand navigation menu.
Recommendations on any host
- Reduce external resources: If you’re calling an image, stylesheet, font, or other resource from a site that’s not hosted on our platform, it’s subject to the caching settings (if there are any), from the server that external resource resides on. Whenever possible, call these resources from your own site, so they can be served using the WP Engine caching layer.
- Drop login requirements: For sites with memberships, asking users to login to the site creates an uncached environment for users. This means the resources and pages of the site will not be utilizing the caching layer. Dropping the requirement to login can definitely help improve cacheability.
Also consider some caveats to utilizing caching
- Sites with higher traffic will see the most benefit to caching. If a site only receives a visit once every couple of hours, it would already be generating the page as new from the server every time, since our caching layer only stores that “snapshot” for 10 minutes.
- Plugins and themes which use PHP Sessions to serve dynamic content to customers may not function correctly, due to caching. Read more here.
- If there is a specific page (other than your site’s home page) which you need to be exempt from caching (like a custom login page, for example), contact Support through Live Chat–available 24/7–to request this.