FacetWP Caching Addon v1.7.1

infoxiao

FacetWP Caching Addon

  FacetWP Caching Addon, database caching for speed. Make FacetWP-powered pages load faster by caching FacetWP-specific AJAX requests in the database.

  FacetWP Caching Addon can help speed up high-traffic pages with commonly used facet combinations by preventing FacetWP from calculating every facet option on every page load.

WordPress Advanced Filtering and Faceted Search Plugin FacetWP + Addons

Each unique facet filter combination a visitor uses will be cached in the database and retrieved from the cache the next time someone selects that combination.

If you have many combinations where users select many different unique choices (for example, entering their own location or making random facet selections), caching AJAX requests won’t help much because those combinations won’t be cached yet.

The FacetWP Cache Plugin is only effective for frequently visited pages (such as the login page) that only contain a few frequently used facets and facet options/combinations.

  The FacetWP caching plugin complements other caching plugins. It doesn’t cache anything other than its own AJAX requests, so it won’t negatively impact other caching systems you’re using.

  It can be used in conjunction with other caching plugins like WP Rocket, as most plugins intentionally ignore AJAX requests.

Installation

  Simply install the plugin and activate it.

  If you want to make sure the plugin is actually working, see the instructions below on how to check if the wp_facetwp_cache database table exists and has an entry, as well as possible reasons and fixes if it doesn’t.

Setting an Expiration Date

  Depending on how often your content changes, you may want to try adjusting the cache expiration time. By default, the cache expires after 1 hour (3600 seconds).

  If your content is only updated once a week or month, it might be wise to extend the cache expiration time. If your content rarely updates, you can set the cache expiration time to a long one, then manually purge the cache when necessary. In fact, this is what we do at facetwp.com, as our demo content almost never changes.

You can adjust the expiration time by adding the following code to your (child) theme’s functions.php:

How to use custom PHP code?

You can add the PHP code to your (child) theme’s functions.php file. Alternatively, you can use a custom hook plugin or a code snippet plugin.

function my_cache_lifetime( $seconds ) {
return 86400; // One day. Default: 3600 (one hour)
}
add_filter( 'facetwp_cache_lifetime', 'my_cache_lifetime' );

Expiration time for specific pages

You can also set custom expiration times for specific pages by adding the following code to your (child) theme’s functions.php:

  How do I use custom PHP code?

  You can add the PHP code to your (child) theme’s functions.php file. Alternatively, you can use a custom hook plugin or a code snippet plugin. More information

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 );

Lightweight WooCommerce Theme: Merchandiser

Clear Cache

How to Clear FacetWP Cache: Once logged in, you’ll see a FWP menu in the black admin bar with an option to Clear All Cache. If you’re on the front-end, the menu will also show an option to clear the cache for just that page.

  Clearing the cache via code

  To clear the cache via code, use the following command:

  How to use custom PHP code?

  You can add the PHP code to your (child) theme’s functions.php file. Alternatively, you can use a custom hook plugin or a code snippet plugin.

FWP_Cache()->cleanup(); // clear expired cache

FWP_Cache()->cleanup( 'all' ); // clear everything

FWP_Cache()->cleanup( 'demo/cars' ); // clear the "/demo/cars/" page

FacetWP Caching Change Log

  • 1.7.1 December 16, 2024
  •   Added the facetwp_admin_settings_capability hook
  •   1.7 June 26, 2023
  •   Added new DB index columns
  •   Improved minor code modernization
  •   PHP8 Deprecation Notice

FacetWP Caching Addon v1.7.1

Related Posts

Multi-vendor marketplace plugin Dokan Business v4.0.5 + Dokan Theme

Elementor Dynamic Content Widget Elementor v3.3.8

WordPress ReviewX Pro v2.0.3

WordPress WP File Download v6.2.8

Leave a Comment