X Features Cars Demo Power Plants Demo State Parks Demo Site Showcase Docs Tutorials Add-ons Buy

Caching

Make FacetWP-powered pages load quicker with page caching.

Installation

Simply activate the plugin. Starting in version 1.5.0, plugin will automatically symlink db.php into the /wp-content/ folder.

Setting the expiration

By default, the cache will expire after 1 hour (3600 seconds). You can adjust the expiration with the following filter:

function my_cache_lifetime( $seconds ) {
    return 86400; // one day
}
add_filter( 'facetwp_cache_lifetime', 'my_cache_lifetime' );

Page-specific expiration

You can also set custom expirations for specific pages:

function my_cache_lifetime( $seconds, $params ) {
    if ( 'products' == $params['uri'] ) { // http://website.com/products/
        $seconds = 1800;
    }
    return $seconds;
}
add_filter( 'facetwp_cache_lifetime', 'my_cache_lifetime', 10, 2 );

Clearing the cache

When logged in and viewing your front-facing page, you’ll see a FWP menu in the black admin bar.

clearing the cache

Changelog

1.5.0

  • Automatically symlink db.php
  • Automatically clear the cache on deactivation

1.4.1

  • Support multisite (props Mark Chouinard)

1.4

  • Show admin bar menu when inside the admin dashboard

1.3.2

  • Added second parameter to facetwp_cache_lifetime filter

1.3

  • Automatic updates!
  • IMPORTANT: before upgrading, please delete the older version

1.2.2

  • Support direct access: FWP_Cache()->cleanup()