mirror of
git://develop.git.wordpress.org/
synced 2025-02-06 23:50:43 +01:00
Tests: Change the wp_cache_get_multiple
function to get cache keys in a single request.
Follow up from [54423]. Change the `wp_cache_get_multiple` function to call the `getMulti` method in the object cache object, to get cache keys in a single call to memcache. This speeds up test by loading caches faster. Props spacedmonkey, SergeyBiryukov. See #54864. git-svn-id: https://develop.svn.wordpress.org/trunk@54942 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ed6fa5c090
commit
ab0feb8b44
@ -323,7 +323,12 @@ function wp_cache_flush( $delay = 0 ) {
|
||||
* @return bool True if the feature is supported, false otherwise.
|
||||
*/
|
||||
function wp_cache_supports( $feature ) {
|
||||
return false;
|
||||
switch ( $feature ) {
|
||||
case 'get_multiple':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -482,6 +487,10 @@ function wp_cache_get_multi_by_key( $server_key, $keys, $groups = '', &$cas_toke
|
||||
*/
|
||||
function wp_cache_get_multiple( $keys, $group = '', $force = false ) {
|
||||
global $wp_object_cache;
|
||||
|
||||
// Prime multiple keys in a single Memcached call.
|
||||
$wp_object_cache->getMulti( $keys, $group );
|
||||
|
||||
return $wp_object_cache->getMultiple( $keys, $group, $force );
|
||||
}
|
||||
|
||||
@ -2161,6 +2170,7 @@ class WP_Object_Cache {
|
||||
if ( ! is_array( $keys ) ) {
|
||||
$keys = (array) $keys;
|
||||
}
|
||||
$keys = array_values( $keys );
|
||||
|
||||
// If we have equal numbers of keys and groups, merge $keys[n] and $group[n].
|
||||
if ( count( $keys ) === count( $groups ) ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user