Quantcast
Channel: Support – Jetpack
Viewing all articles
Browse latest Browse all 385

Caching site content with Jetpack Boost

$
0
0

Speed up website performance by storing frequently accessed content locally, reducing load times for visitors. 

Installing the Jetpack Boost plugin

To take full advantage of the caching feature, you’ll first need to install and activate the Jetpack Boost plugin. Follow the steps below to get started:

  1. Start from your site’s WP Admin.
  2. Navigate to Plugins and click the Add New button from the top of the page.
  3. Search for the Jetpack Boost plugin.
  4. Find “Jetpack Boost – Website Speed, Performance and Critical CSS” and click Install Now, then Activate button.

Enabling the Cache Feature

When the Jetpack Boost plugin is active, you can enable the cache feature by following the steps below:

  1. Start from your site’s WP Admin.
  2. Navigate to Jetpack → Boost.
  3. Locate the “Cache Site Pages” and use the toggle to enable the feature

Disabling any other caching system present on the site

If your site uses a caching plugin or if your hosting provider includes a caching system, you might see a little warning pop-up after you turn on the Cache Site Pages feature in Boost. This is just to let you know that Jetpack Boost couldn’t activate the feature due to the existing cache setup.

Jetpack Boost is unable to activate cache if there’s another cache system in place

To benefit from Jetpack Boost’s integrated functionalities, including its caching feature and all the other features, you must disable the other caching system. If it’s a plugin, please deactivate it, and if it’s from your host, please contact the hosting provider for assistance. 

Please note that some hosting providers will not allow you to choose your own page caching solution. In such cases, Boost’s page cache cannot be enabled on your site. 

The technical side of caching

All page caches used by WordPress must use a special file in your wp-content directory called advanced-cache.php to drive their caching features. Jetpack Boost will show a message like the above if we detect an advanced-cache.php file in your wp-content directory.

If you have access to the files in your WordPress installation, check this file to see if it contains information about what caching solution you currently have configured.

If you have an empty advanced-cache.php file installed, your hosting provider may have placed that file there to prevent you from using your own page caching solution. In such cases, your hosting provider likely has a cache built-in. We recommend that you contact your hosting provider for information.

Excluding Specific Parts of the site from Caching

You may have certain pages on your site, such as the cart page or those with frequently updated content, that you prefer not to cache to ensure they always display the most current version. Jetpack Boost offers a straightforward way to designate which areas of your site should remain uncached.

To exclude different parts of the site from caching, you can follow the steps:

  1. Navigate to Jetpack → Boost in your WP Admin
  2. Enable the Cache Site Pages module.
  3. Look for a Show Options button on the right side and click it. This action will reveal a field for input.
  4. In this new field, enter the paths for any parts of the site you wish to keep uncached.
Excluding Specific Parts of the site from Caching

Remember, you don’t need to use full URLs here. For instance, to exclude a shop page from being cached, simply input “/shop” (without the quotes). Place each path on its own line. If you need to exclude multiple pages under a single directory, you can use the wildcard symbol (.*) in your path. This might look like /blog/(.*) to exclude all pages under the “blog” section. 

Tracking Caching Events (logging)

If you run into trouble while using the cache, it can sometimes be helpful to enable its Logging feature to track events that occur in the caching system. 

To track caching events, follow these steps:

  1. Navigate to Jetpack → Boost in your WP Admin
  2. Enable the Cache Site Pages module.
  3. Click the Show Options button on the right side. 
  4. Check the option to activate logging. 
  5. Click See logs to see the logs and caching events.
Enabling tracking caching events

Typically, the cache logging system will track which pages are being cached, which are being served from your cache, and when your cache is deleted due to either the cache becoming too old, or due to changes on your site.

Please note that this feature is normally disabled by default, as writing extra logs to your disk may have a small performance impact on your server. Remember to deactivate the logging system once you have finished troubleshooting any problem you may need to investigate.

Clearing cache 

To clear the cache, click Clear Cache button from the Cache Site Pages feature section:

Clearing Cache

Jetpack Boost’s page cache automatically clears cached content when you update, publish, or delete a post; when a comment is modified, added, or removed; or when you switch themes. This ensures your site’s content remains current without any extra effort on your part.

Content stays cached for 1 hour. This can be changed by adding a line to your site’s wp-config.php file.

define( 'JETPACK_BOOST_CACHE_DURATION', 3600 );

Where 3600 is the duration of the cache in seconds.

However, WordPress comes with a wide variety of plugins and settings, so it can miss some updates. If you notice that some content on your site appears to be out-of-date after making a change, you can clear your page cache at any time.  

Frequently Asked Questions

How do I know it’s working?

The plugin only caches page requests by logged-out visitors. In a private or incognito browser, visit your site and then bring up the Web Developer console and navigate to the Network tab.

Clear the list, then reload the page. Click on the entry for your page and examine the Response Headers. You will find one called “X-Jetpack-Boost-Cache” with a value “hit” if it was served from the cache. If the page wasn’t cached, the value will be “miss”.

On your server, look in wp-content/boost-cache/cache/ for cached files.

Can I change how long content stays cached?

Yes, you can adjust the cache duration by adding define( 'JETPACK_BOOST_CACHE_DURATION', 3600 ); to your site’s wp-config.php file, where “3600” is the cache duration in seconds. Change 3600 to suit your needs.

Can I use Jetpack Boost alongside other performance optimization plugins?

While Jetpack Boost can work alongside other performance optimization plugins, it’s essential to ensure there are no overlapping features that could conflict, particularly other caching mechanisms. It’s recommended to use one caching solution at a time for optimal performance.

How often should I clear the cached content?

Jetpack Boost automatically clears cached content when posts are updated, published, or deleted, and when comments are modified or removed. Manual cache clearing should only be necessary if you notice outdated content that hasn’t been automatically refreshed.

Will enabling Jetpack Boost’s cache feature affect my website’s SEO?

Improving your site’s loading speed by caching content can positively impact your SEO. Faster sites provide a better user experience, which is a factor search engines consider when ranking sites.

How do I update a cached page with out-of-date content?

If content appears out-of-date on a single page, you can clear the cache by editing the page and saving it again. You can also manually clear the cache by clicking the Clear Cache button in the Cache Site Pages module within Jetpack → Boost. This ensures your site displays the most current content.

If you are working on a PHP script and need to clear the cache, you can also use the jetpack_boost_clear_page_cache_url action to clear a single page like this:

`do_action( 'jetpack_boost_clear_page_cache_url', 'https://example.com/my-fabulous-page/' );`

Or clear the entire cache with `jetpack_boost_clear_page_cache_all`:

`do_action( ‘jetpack_boost_clear_page_cache_all’ );`

What developer tools does Jetpack Boost offer for customizing caching behavior?

Jetpack Boost provides several filters for developers: jetpack_boost_cache_bypass_patterns for changing bypass patterns, jetpack_boost_cache_request_cacheable to specify cacheable requests, and jetpack_boost_cache_accept_headers to modify caching based on content types. Further details can be found in the Cache API documentation.

Troubleshooting caching issues

For troubleshooting Jetpack Boost caching issues, please refer to our Troubleshooting Guide for detailed solutions.

Get help

Need more help? Feel free to contact us! For free Jetpack Boost users, you can post a support request on the Jetpack Boost Plugin Support page. If you upgraded, you can contact support for more personalized assistance.

Privacy Information

The Cache feature is deactivated by default. You can toggle the feature on or off from Jetpack → Boost in your WP Admin dashboard.

Data Used
Site Owners / Users

We track which kinds of errors users encounter while setting up Boost Cache, to enable us to identify common pain points for users and target future improvements.
Site Visitors

None.

Activity Tracked
Site Owners / Users

We track activities such as enabling the Cache feature and altering its settings. We use this data to identify common usage patterns to better target our future improvements.
Site Visitors

None.

Data Synced (Read More)
Site Owners / Users

None.
Site Visitors

None.

Viewing all articles
Browse latest Browse all 385

Latest Images

Trending Articles



Latest Images