wp_cache_flush_runtime()
Removes all cache items from the in-memory runtime cache.
Compat function to mimic wp_cache_flush_runtime().
No Hooks.
Return
true|false
. True on success, false on failure.
Usage
wp_cache_flush_runtime();
Examples
#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() wp cache flush runtime code WP 6.1.1
function wp_cache_flush_runtime() { if ( ! wp_cache_supports( 'flush_runtime' ) ) { _doing_it_wrong( __FUNCTION__, __( 'Your object cache implementation does not support flushing the in-memory runtime cache.' ), '6.1.0' ); return false; } return wp_cache_flush(); }