Cache API: Include the `cache-compat` file.

This was missed during the prior commit.

See [47938].



git-svn-id: https://develop.svn.wordpress.org/trunk@47939 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jake Spurlock 2020-06-09 19:48:18 +00:00
parent d4d78e4ae7
commit 128b5b8491
1 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<?php
/**
* Object Cache API functions missing from 3rd party object caches.
*
* @link https://codex.wordpress.org/Class_Reference/WP_Object_Cache
*
* @package WordPress
* @subpackage Cache
*/
if ( ! function_exists( 'wp_cache_get_multiple' ) ) :
/**
* Compat function to mimic wp_cache_get_multiple.
* Retrieves multiple values from the cache.
*
* @ignore
* @since 5.5.0
*
* @see wp_cache_get_multiple()
*
* @param array $keys Array of keys to fetch.
* @param bool $force Optional. Unused. Whether to force a refetch rather than relying on the local
* cache. Default false.
*
* @return array Array of values organized into groups.
*/
function wp_cache_get_multiple( $keys, $group = 'default', $force = false ) {
$values = array();
foreach ( $keys as $key ) {
$values[ $key ] = wp_cache_get( $key, $group, $force );
}
return $values;
}
endif;