mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Cache API: Add wp_cache_flush_runtime
function
Add a new function called `wp_cache_flush_runtime` to existing caching functions found in WordPress. This function allows users to flush the runtime (in-memory) cache, without flushing the entire persistent cache. Props: Spacedmonkey, tillkruess, flixos90, adamsilverstein, SergeyBiryukov, barryhughes. Fixes: #55080. Built from https://develop.svn.wordpress.org/trunk@52772 git-svn-id: http://core.svn.wordpress.org/trunk@52361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
76207c890b
commit
7a48bab20c
@ -123,3 +123,21 @@ if ( ! function_exists( 'wp_cache_delete_multiple' ) ) :
|
|||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
if ( ! function_exists( 'wp_cache_flush_runtime' ) ) :
|
||||||
|
/**
|
||||||
|
* Removes all cache items from the in-memory runtime cache.
|
||||||
|
*
|
||||||
|
* Compat function to mimic wp_cache_flush_runtime().
|
||||||
|
*
|
||||||
|
* @ignore
|
||||||
|
* @since 6.0.0
|
||||||
|
*
|
||||||
|
* @see wp_cache_flush_runtime()
|
||||||
|
*
|
||||||
|
* @return bool True on success, false on failure.
|
||||||
|
*/
|
||||||
|
function wp_cache_flush_runtime() {
|
||||||
|
return wp_using_ext_object_cache() ? false : wp_cache_flush();
|
||||||
|
}
|
||||||
|
endif;
|
||||||
|
@ -268,6 +268,19 @@ function wp_cache_flush() {
|
|||||||
return $wp_object_cache->flush();
|
return $wp_object_cache->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all cache items from the in-memory runtime cache.
|
||||||
|
*
|
||||||
|
* @since 6.0.0
|
||||||
|
*
|
||||||
|
* @see WP_Object_Cache::flush()
|
||||||
|
*
|
||||||
|
* @return bool True on success, false on failure.
|
||||||
|
*/
|
||||||
|
function wp_cache_flush_runtime() {
|
||||||
|
return wp_cache_flush();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the cache.
|
* Closes the cache.
|
||||||
*
|
*
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.0-alpha-52768';
|
$wp_version = '6.0-alpha-52772';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user