WordPress at a glance

wp_suspend_cache_addition() WP 1.0

Temporarily suspend cache additions.

Stops more data being added to the cache, but still allows cache retrieval. This is useful for actions, such as imports, when a lot of data would otherwise be almost uselessly added to the cache.

Suspension lasts for a single page load at most. Remember to call this function again if you wish to re-enable cache adds earlier.

  • Static. true/false. $_suspend

No Hooks.

Return

true/false. The current suspend setting

Usage

wp_suspend_cache_addition( $suspend );
$suspend(true/false)
Suspends additions if true, re-enables them if false.
Default: null

Code of wp_suspend_cache_addition: wp-includes/functions.php VER 4.9.8

<?php
function wp_suspend_cache_addition( $suspend = null ) {
	static $_suspend = false;

	if ( is_bool( $suspend ) )
		$_suspend = $suspend;

	return $_suspend;
}

Related Functions

From tag: cache (caching)

No comments
    Hello, !     Log In . Register