All 19 NimbleCache sections
For developers
// Refuse to cache a page, with a reason that shows in Diagnostics.
add_filter( 'trnc_bypass', function ( $reason ) {
return is_page( 'live-scores' ) ? 'live-data' : $reason;
} );
// Purge something of your own.
do_action( 'trnc_purge_url', 'https://example.com/prices/' );
do_action( 'trnc_purge_post', $post_id );
do_action( 'trnc_purge_all' );
// Add pages to purge when a post changes. The pages listed under
// Settings → Clearing → Also clear these pages are already in $urls.
add_filter( 'trnc_purge_urls_for_post', function ( $urls, $post_id ) {
$urls[] = home_url( '/latest/' );
return $urls;
}, 10, 2 );
// A cookie that should split the cache — a currency switcher, say.
add_filter( 'trnc_variant_cookies', function ( $cookies ) {
$cookies[] = 'my_currency';
return $cookies;
} );
// Another host of this site's own that keeps its own cached pages — a
// language on a domain of its own that WPML and Polylang do not report.
add_filter( 'trnc_hosts', function ( $hosts ) {
$hosts[] = 'example.fr';
return $hosts;
} );
// After a purge: one address, or the whole cache. $why['k'] is 'button' or
// 'cli' when a person asked for the whole cache to be cleared.
add_action( 'trnc_purged_url', function ( $url, $files ) {}, 10, 2 );
add_action( 'trnc_purged_all', function ( $pages, $why ) {}, 10, 2 );
// How long asking the cache in front may take: 8 seconds, or 20 in a
// scheduled task or WP-CLI ($background).
add_filter( 'trnc_upstream_seconds', function ( $seconds, $background ) {
return $seconds;
}, 10, 2 );DONOTCACHEPAGE is honoured, so anything already using that convention works without changes.
Still stuck? Ask the developers who wrote it. We aim to reply within one business day.