mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Cache API: Introduce wp_cache_supports() function.
WordPress has recently introduced a variety of caching API improvements: * `wp_cache_add_multiple()` * `wp_cache_set_multiple()` * `wp_cache_get_multiple()` * `wp_cache_delete_multiple()` * `wp_cache_flush_runtime()` * `wp_cache_flush_group()` Although WordPress core provides a compatibility layer if these functions are missing from third-party object cache implementations, there should be a method of checking whether the cache backend supports a particular feature. This commit aims to improve developer experience by allowing third-party object cache plugins to declare a `wp_cache_supports()` function and correctly list their supported features: * `add_multiple` * `set_multiple` * `get_multiple` * `delete_multiple` * `flush_runtime` * `flush_group` Note: The `wp_cache_supports()` function replaces and supersedes the `wp_cache_supports_group_flush()` function added earlier. Follow-up to [47938], [47944], [52700], [52703], [52706], [52708], [53763], [53767], [54423]. Props johnjamesjacoby, tillkruess, spacedmonkey, SergeyBiryukov. Fixes #56605. git-svn-id: https://develop.svn.wordpress.org/trunk@54448 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -313,13 +313,16 @@ function wp_cache_flush( $delay = 0 ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the object cache implementation supports flushing individual cache groups.
|
||||
* Determines whether the object cache implementation supports a particular feature.
|
||||
*
|
||||
* @since 6.1.0
|
||||
*
|
||||
* @return bool True if group flushing is supported, false otherwise.
|
||||
* @param string $feature Name of the feature to check for. Possible values include:
|
||||
* 'add_multiple', 'set_multiple', 'get_multiple', 'delete_multiple',
|
||||
* 'flush_runtime', 'flush_group'.
|
||||
* @return bool True if the feature is supported, false otherwise.
|
||||
*/
|
||||
function wp_cache_supports_group_flush() {
|
||||
function wp_cache_supports( $feature ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user