clock Last Modified: Feb 6, 2019

Presslabs cache specifications

Last modified: February 6, 2019

Cache information can be vital to your site performance. This is an overview of our Presslabs cache system, containing information about cache types, cached pages, expiration times, as well as a quick list of parameters we cache & pass to the back-end.

Our proprietary WordPress caching layer is in place for all our customers, ranging from the civic NGO projects that we host for free up to the most demanding enterprise hosting customers.

There are 2 caches: one for the CDN, and one for the website’s HTML. The items in the CDN cache do not expire automatically and must be manually purged from the Cache section of your Presslabs Dashboard.

The cached pages have different expiration times based on their freshness. They have by default the following expiry times:

  • articles and pages newer than 2 days: 30 minutes (0.5 x base)
  • articles and pages newer than 30 days: 1 hour (1 x base)
  • articles and pages newer than 365 days: 4 hours (4 x base)
  • older articles and pages: 1 day (24 x base)
  • all other content: 1 hour

The multipliers cannot be changed, but the base TTL (which is 3600 seconds by default) can be increased by requesting this to our support team.

Please note that the taxonomy archives, the date archives, and the front page are invalidated on each post or page publication, or update. When comments are made, deleted, approved, or marked as spam, that particular article is refreshed as well.

Another important note is that an item can be refreshed only every 15 seconds. So, if you repeatedly click the Update button in the WordPress editor too soon, the content will not be refreshed.

Starting with April 2016 we’re caching all the GET requests, for any resources (even PHP, excluding some key paths like wp-login.php, wp-signup.php, wp-cron.php and xmlrpc.php). In order to make a request more cache-friendly and reliable we’re stripping down all the parameters which are not standard. In other words non-standard parameters are not passed to the backend (where php gets executed). This is the list of parameters which we cache and pass to the backend (WP API specific arguments and WP Query Vars from WordPress Query Vars – Codex):

  • _ajax_nonce
  • action
  • attachment_id
  • author
  • author_email
  • author_exclude
  • context
  • exclude
  • feed
  • hide_empty
  • karma
  • id
  • include
  • media_type
  • meme_type
  • menu_order
  • offset
  • order
  • orderby
  • p
  • page
  • paged
  • page_id
  • parent
  • parent_exclude
  • per_page
  • post
  • postid
  • relatedposts
  • robots
  • s
  • search
  • slug
  • status
  • type
  • wpmp_switcher
  • wptouch_switch

Besides this list, all filter parameters like filter[*] are also passed to the backend and cached.

Additionally, you can add custom non-strippable parameters from our dashboard, see the cache section.

Manage absolute TTL for resources

If you have a page or post that needs a special cache refresh policy you can set the X-Accel-Expires header to the value you desire. Here is a sample code snippet

In this example the TTL is set for 5 minutes and the resource is /feed/:

add_action( 'send_headers', 'add_header_x_accel_expires' );
function add_header_x_accel_expires() {
    if ( strpos ( $_SERVER['REQUEST_URI'], '/feed/' ) === 0 ) {
        header( 'X-Accel-Expires: 300'); // number of seconds