wp_cache_flush_runtime()WP 6.0.0

Removes all cache items from the in-memory runtime cache.

No Hooks.

Return

true|false. True on success, false on failure.

Usage

wp_cache_flush_runtime();

Examples

0

#1 Example of use

In the example below, the object cache will be flushed after 100 posts have been added to the database:

$counter = 0;

foreach ( $posts as $post ) {
	$counter++;

	wp_insert_post( $post );

	if ( 100 === $counter ) {
		wp_cache_flush_runtime();
		$counter = 0;
	} 

}

Notes

Changelog

Since 6.0.0 Introduced.

wp_cache_flush_runtime() code WP 6.4.3

function wp_cache_flush_runtime() {
	return wp_cache_flush();
}