Knowledgebase » How to ... »
Using a WordPress caching plugin or the built-in cache plugins from your hosting requires adjustment to work nicely with HBook. There are two aspects concerned :
Depending on your website structure, and on the caching tool that is in place on your website, we recommend implementing the following :
You can use our filters to execute the function that will clear/flush cache, each time a reservation is received or updated. The filters that should be used are "hb_reservations_updated" and "hb_blocked_accom_updated". You can consult the list of available filters in our documentation.
Please find below a couple of examples for popular caching tools :
LiteSpeed (documentation reference)
function my_custom_flush_cache() { do_action( 'litespeed_purge_all' ); } add_filter( 'hb_reservations_updated', 'my_custom_flush_cache' ); add_filter( 'hb_blocked_accom_updated', 'my_custom_flush_cache' );
SG Optimizer SuperCacher
function my_custom_flush_cache() { if (function_exists('sg_cachepress_purge_cache')) { sg_cachepress_purge_cache(); }}add_filter( 'hb_reservations_updated', 'my_custom_flush_cache' );add_filter( 'hb_blocked_accom_updated', 'my_custom_flush_cache' );
WPFastest cache (documentation reference)
function my_custom_flush_cache() { if ( function_exists( 'wpfc_clear_all_cache' ) ) { wpfc_clear_all_cache(); } } add_filter( 'hb_reservations_updated', 'my_custom_flush_cache' ); add_filter( 'hb_blocked_accom_updated', 'my_custom_flush_cache' );
WPRocket
function my_custom_flush_cache() { if ( function_exists( 'rocket_clean_domain' ) ) { rocket_clean_domain(); } } add_filter( 'hb_reservations_updated', 'my_custom_flush_cache' ); add_filter( 'hb_blocked_accom_updated', 'my_custom_flush_cache' );
WP Super Cache
function my_custom_flush_cache() { if ( function_exists( 'wp_cache_clear_cache' ) ) { wp_cache_clear_cache(); } } add_filter( 'hb_reservations_updated', 'my_custom_flush_cache' ); add_filter( 'hb_blocked_accom_updated', 'my_custom_flush_cache' );
WP Optimize
function my_custom_flush_cache() { if ( function_exists( 'get_page_cache' ) ) { WP_Optimize()->get_page_cache()->purge(); } } add_filter( 'hb_reservations_updated', 'my_custom_flush_cache' ); add_filter( 'hb_blocked_accom_updated', 'my_custom_flush_cache' );
W3 Total Cache
function my_custom_flush_cache() { if ( defined( 'W3TC' ) ) { $w3_plugin_totalcache->flush_all(); }}add_filter( 'hb_reservations_updated', 'my_custom_flush_cache' ); add_filter( 'hb_blocked_accom_updated', 'my_custom_flush_cache' );
If you don't know whether the cache plugin you wish to use have this flush function that can be called, you can browse their documentation or get in touch with their support team.