Manage website cache

Clear caches, setup cache exclusions and enable persistent object cache

T
Written by Team Pressidium
Updated over a week ago

Page Cache

Page caching is a key feature in our platform, and it significantly enhances website performance and speed by storing and serving a copy of the full page response generated by a website from memory (or a super fast SSD). At Pressidium full page caching is implemented in at least two caching layers, "hot" and "warm". These layers are part of our adaptive cache engine and work in tandem based on your website's caching profile to ensure optimal website performance. Hot cache serves data from memory for quick retrieval and reduced latency. Warm Cache serves data that reside in state-of-the-art super fast SSD disks and is used for data that is accessed less frequently but still requires rapid access when needed. Page cache is enabled and configured, out of the box, in all Pressidium plans and provides significant benefits:

  • Faster Page Loading: Cached pages load significantly faster because they eliminate the need to re-run complex PHP scripts and database queries for every visitor.

  • Reduced Infrastructure Load: Since cached pages are served without the underlying infrastructure having to regenerate them, it reduces the server's processing load, allowing it to handle more concurrent visitors.

  • Improved Scalability: Our caching engine enables websites to handle traffic spikes and high visitor loads transparently and more efficiently.

  • Better User Experience: Faster loading times lead to improved user satisfaction and reduced bounce rates.

Important: Page Cache is enabled by default in the production environment of your website and cannot be disabled.

Clear full page cache

Our page caching mechanism is deeply integrated with WordPress and, by default, will automatically clear the page cache for several URLs (e.g. homepage, single post/page URL, page archives, etc.) when a post or page is created or updated. There are occasions when you may find it necessary to manually clear the cache, such as when you update content or make changes to your website, either through the WordPress admin interface or by updating files via SFTP.

To clear page cache only:

  • Navigate to Cache -> Cache Management screen.

  • Locate the Page Cache section.

  • Click Clear and again Clear on the confirmation dialog box.

A background job will be started to clear the website's full page cache.

To clear all caches (this includes the full page cache):

  • Navigate to Cache -> Cache Management screen.

  • Locate the All Cache section.

  • Click Clear All and again Clear on the confirmation dialog box.

A background job will be started to clear the website's full page cache.

Alternatively you can clear all caches using the Production Operations -> Clear Cache action on the navigation bar. See the steps at https://help.pressidium.com/en/articles/1923181-clear-your-wordpress-site-cache for more details.

Additionally you can also programmatically control and customize the cache clear behavior by using the methods exposed by the Pressidium MU plugin: https://help.pressidium.com/en/articles/6115759-purging-additional-paths-when-clearing-cache.

Manage page cache URL exclusions

Not all content is suitable for caching. Certain dynamic or personalized elements on your site should be excluded from the caching process to ensure a smooth user experience. Page cache exclusions refer to specific parts or elements of your website that are deliberately excluded from the page caching process. When a user visits your website, our multi-layer caching engine inspects the request and decides if it is possible to serve cached versions of pages to significantly reduce loading times. Page cache exclusions, on the other hand, ensure that certain content remains dynamic and is generated in real-time, rather than being pulled from a cached version. Our platform, by default, excludes several requests from being served from the cache such as:

  • HTTP POST requests

  • Responses with 401 Unauthorized HTTP code status

  • Requests with an HTTP Authorization header (e.g. password-protected websites)

  • Cart pages on popular Commerce plugins (e.g. WooCommerce)

  • When a WordPress login session is detected (e.g. a user is logged in to the WordPress administration interface, an LMS logged-in user, an e-commerce logged-in user )

Depending on your website's functionality it might be required to exclude additional URLs from our caching mechanism. Such cases might include:

  1. Dynamic Content: Dynamic content includes elements such as user-specific information, shopping carts, search results, login forms, and more. Excluding these elements from caching ensures that each user receives personalized and up-to-date content.

  2. E-commerce Functionality: If your website incorporates e-commerce functionality, page cache exclusions are essential to ensure that product prices, availability, and cart contents remain accurate and dynamic for each visitor. E.g. if you are running a multi-language e-commerce store, it might be required to exclude the language-specific user profile or cart pages from the cache.

  3. User-Specific Data: Many websites utilize user-specific data, such as profiles, preferences, and customized content. Page cache exclusions prevent cached pages from displaying the wrong information to users by ensuring that these elements are generated dynamically based on each user's unique context.

  4. Forms and Interactivity: Forms, comment sections, and interactive features like polls or voting systems rely on real-time data processing. Excluding these elements from caching ensures that user interactions are properly recorded and processed without interference from cached content.

You can configure a set of URLs to always bypass the cache mechanism and be dynamically generated in real time by adding them in a website's URL cache exclusions list.

To add a URL exclusion:

  • Navigate to Cache -> Exclusions screen.

  • Locate the Exclude URL Paths from Cache section.

  • Input the path to exclude in the URL Path input box. You can add up to 3 exclusions at a time by clicking the + button.

  • Click Exclude.

A background job will start to update the cache configuration. We will receive a Dashboard notification as soon as the process is finished.

To remove one or more URL exclusions:

  • Navigate to Cache -> Exclusions screen.

  • Locate the List of Excluded URL Paths section.

  • Select the entries from the list (you can select multiple entries) and click the Remove Selected button. You can also right click on an entry and choose Remove from the drop-down menu.

A background job will start to update the cache configuration. You will receive a Dashboard notification as soon as the process is finished.

Add only the minimum number of exclusions to help resolve issues or incompatibilities with the page caching mechanism. Excluding multiple pages from the Page Cache might negatively affect the performance of your website.

Important notes about exclusions:

  • URLs must start with a forward slash (/).

  • The exact URL plus any child pages (sub paths) will be excluded from cache. For example if you exclude /articles both /articles/my-article-1 and /articles/my-article-2 will be excluded from page caching.

  • We strongly advice to be as specific as possible when adding URL path exclusions to avoid excluding unwanted paths from the page cache.

  • Partial matching is not supported. If you want to exclude a URL based on an ending path segment or a partial keyword/string please reach out to our support team.

  • All exclusions are URL path-based. Matching on query strings is not supported.

  • Up to 15 entries / URLs can be added for each environment.

  • You cannot exclude a website's homepage (/) from the page cache.

  • The list might contain entries added by our platform team (indicated with a "lock" icon in the UI). These entries cannot be deleted via the Dashboard. You will need to contact our support team and request the entry to be removed.

  • URL exclusions are applied to all mapped domains of a website.

  • Adding or removing a cache exclusion will automatically trigger a Page Cache clear action.

  • The URL exclusion list does not include URLs that are excluded by default by our caching engine.

Purge one or more URLs from page cache

You can select to clear one or more URLs from the page cache from the Dashboard. This is useful in cases where you are making changes to a specific set of pages or files and don't need to clear the whole cache.

  • Navigate to Cache -> Cache Management screen.

  • Locate the Purge URLs from Page Cache section.

  • Input the path to exclude in the URL Path input box. You can add up to 3 URLs at a time by clicking the + button.

  • Click Purge.

A background job will start to clear the page cache for the specific URLs. You will receive a Dashboard notification as soon as the process is finished.

For standard, standalone, websites, we clear the cache for the primary domain's specific URL path. In the case of multi-site websites, you can choose whether the cache clearance will affect the primary domain exclusively or apply to all domains mapped to the website.

If your are purging a static asset (or resource) and the CDN service is enabled, it is recommended to also clear the CDN cache.

Persistent Object Cache

A Persistent Object Cache helps speed up page load times by saving on repeated trips to the database from the application / web server. For example, your site’s options data needs to be available for each page view. Without a persistent object cache, the application / web server must read those options from the database to handle every page view. Those extra trips to the database might slow down response times (TTFB - Time to First Byte) and can lead to overall reduced performance or slowness. With persistent object cache enabled database query results, or other types of data, such as results from remote HTTP calls, can be stored (cached) in super fast memory storage and retrieved efficiently, directly from memory, without re-accessing the, usually, slower, resource. Pressidium, out of the box, provides an efficient Object cache, fully integrated with the rest of our multi-adaptive cache engine using a Redis back-end (a really fast in-memory key/value database).

Object caching is not enabled by default but must be enabled manually. The main reason is that while Object Cache can provide significant performance improvements, its use might cause issues with plugins and/or themes.

Enable Object Cache

To enable Object Cache:

  • Navigate to Cache -> Cache Management screen.

  • Locate the Persistent Object Cache section

  • Toggle the respective setting to ON.

  • Click Enable on the confirmation dialog.

A background job will start to update the cache configuration. You will receive a Dashboard notification as soon as the process is finished.

It is recommended to clear the website's cache after enabling Object Cache.

Disable Object Cache

To disable Object Cache:

  • Navigate to Cache -> Cache Management screen.

  • Locate the Persistent Object Cache section.

  • Toggle the respective setting to OFF.

  • Click Disable on the confirmation dialog.

It is recommended to clear the website's cache after disabling Object Cache.

Clear / Purge Object Cache from the Dashboard

To clear all entries from the Object Cache:

  • Navigate to Cache -> Cache Management screen.

  • Locate the Persistent Object Cache section.

  • Click Clear and confirm the action to start a background job to clear the object cache.

Clear / Purge Object Cache from the Pressidium Panel in WordPress administration interface.

To clear all entries from the Object Cache:

  • Locate the Pressidium menu item on the sidebar.

  • Navigate to Adaptive Caching.

  • Locate the Cache Control section.

  • Click Purge WP Object Cache to start a background job to clear the object cache.

Important notes about Persistent Object Cache:

  • Ensure that your plugins and/or themes are compatible with WordPress Object cache before enabling this option. You can use a website clone to conduct testing and review your website's behavior before enabling Object Cache in your production environment.

  • While, in most cases, enabling Object Cache gives a significant boost to your website's performance, in rare cases, it might cause slowdowns and performance problems. Some items that might negatively affect the performance of Object Cache include:

    • Large collections of transients or an "overweight" wp_options table.

    • Transients or wp_options entries with large size (several KB or MBs)

    • Repeating / excessive data access patterns, i.e. themes or plugins that make repeated access to the object cache (mixed writes and reads), during a single HTTP request.

Additional resources:

CDN Cache

When the CDN service is enabled for a website, static assets are served directly from the CDN edges, closest to the website visitor, to improve overall delivery speed and latency. Our CDN keeps its own cache to avoid round-trips to the "origin" server (i.e. where your media files are originally uploaded and served). It is sometimes useful to clear the CDN cache, particularly when you modify or replace static files (CSS files, Javascript files, media files, etc.) on your website. Clearing the CDN cache will instruct our CDN to fetch new versions of your files, when requested by a visitor, and cache those new versions instead.

To clear the CDN cache:

  • Navigate to Cache -> Cache Management screen.

  • Locate the CDN Cache section.

  • Click Clear and confirm the action to start a background job to clear the CDN cache.

Reviewing Cache behavior

You can get insights on how the Caching engine is performing with your website and whether there is content that is excluded from caching, bypassing the cache engine directly from the Dashboard using our fully integrated Analytics suite.

  • Navigate to Analytics -> Caching screen.

  • Review overall performance by inspecting the HIT/MISS KPIs and trends.

  • Review cache status behavior over time

  • Review top URLs based on cache hits.

  • Review top URLs that miss or bypass the cache.

Data includes HIT / MISS / BYPASS details with further information on the status of a request available by hovering over the tool-tip next to the URL request listed in the Caching panel. Any excluded URL paths will be listed under the BYPASS group on the related list. You can learn more about the data provided in the related website analytics article.

Identifying Cache Behavior using HTTP headers

To check whether page caching is active and to gain insights into the cache status of your site, you can inspect HTTP headers, such as the X-Cache header, using your browser's developer tools or an HTTP client (such as curl).

Detect cache usage using browser Developer Tools

  1. Open Your Website: Launch your web browser and navigate to your WordPress website.

  2. Access Developer Tools:

    • Google Chrome: Right-click anywhere on the page and select "Inspect" or press Ctrl+Shift+I (or Cmd+Option+I on macOS) to open the Chrome DevTools.

    • Mozilla Firefox: Right-click anywhere on the page and select "Inspect Element" or press Ctrl+Shift+I (or Cmd+Option+I on macOS) to open the Firefox Developer Tools.

  3. Navigate to the Network Tab: Within the Developer Tools, locate and click on the "Network" tab. This tab displays network activity, including HTTP requests and responses.

  4. Reload the Page: Click the browser's refresh button or press F5 (or Cmd+R on macOS) to reload the page.

  5. Inspect the HTTP Headers:

    • After reloading the page, you'll see a list of network requests in the Network tab.

    • Locate the main request for your website (usually the first one in the list). It should be the URL of your website, such as https://your-website.com.

    • Click on this request to view detailed information about it, including the HTTP headers.

  6. Look for the X-Cache Header: Scroll through the headers, and search for the X-Cache header in the "Response Headers" section.

    • If you see an X-Cache header with a value like HIT, it indicates that the page was served from cache. This means that full page caching is active on your website and the page was retrieved from the cache instead of being generated dynamically.

    • If you see an X-Cache header with a value like MISS, it indicates that the page was not served from cache.

    • In case the URL is excluded from the cache, an additional header X-Cache-Why will be present. For user specified exclusions this header will have the value url:bypass.

    • If you don't find an X-Cache header, ensure that your website is indeed served by Pressidium's infrastructure by verifying that the DNS records point to the correct IPs. If you are using a reverse proxy setup or have setup an additional proxy or custom CDN ensure that their configuration is properly forwarding and handling origin HTTP headers.

Here's an example of what the X-Cache header might look like in the Firefox Developer Tools:

In this example, the X-Cache header indicates that the page was served from cache (HIT).

Detect cache usage using a command line HTTP client (e.g. curl)

You can also inspect HTTP headers and the X-Cache header using a command line HTTP client. A popular cross platform HTTP client is curl.

  1. Ensure that you have curl installed. Depending on your operating system the installation method might differ.

  2. Open your Terminal/Command Prompt: Launch the terminal or command prompt on your local machine.

  3. Use the curl Command: Enter the following command, replacing your-website.com with your WordPress website's URL:

curl -I https://your-website.com

The -I option tells curl to fetch the HTTP headers of the specified URL.

Review the Output: After running the curl command, you'll see a list of HTTP headers. Look for the X-Cache header, which can provide insights into the caching status.

  • If you see an X-Cache header with a value like ΗΙΤ, it means that the page was served from cache.

Here's an example of what the curl output might look like:

HTTP/2 200
date: Tue, 26 Sep 2023 16:08:21 GMT
content-type: text/html; charset=UTF-8
content-length: 161431
x-cache-level: A
cache-control: must-revalidate, max-age=0
x-cache: HIT:(292:lb1-c5-1)
server: Pressidium

In this example, the X-Cache header shows that the page was served from cache (HIT).

Did this answer your question?