wp_suspend_cache_addition

Temporarily suspend cache additions.

Description

wp_suspend_cache_addition( (null) $suspend = null ); 

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.

Parameters (1)

0. $suspend — Optional. (null) => null
Suspends additions if true, re-enables them if false.

Usage

  1. if ( !function_exists( 'wp_suspend_cache_addition' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4. // Optional. Suspends additions if true, re-enables them if false. 
  5. $suspend = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_suspend_cache_addition($suspend); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.php  
  1. function wp_suspend_cache_addition( $suspend = null ) { 
  2. static $_suspend = false; 
  3.  
  4. if ( is_bool( $suspend ) ) 
  5. $_suspend = $suspend; 
  6.  
  7. return $_suspend;