cache-compat.php (1046B)
1 <?php 2 /** 3 * Object Cache API functions missing from 3rd party object caches. 4 * 5 * @link https://codex.wordpress.org/Class_Reference/WP_Object_Cache 6 * 7 * @package WordPress 8 * @subpackage Cache 9 */ 10 11 if ( ! function_exists( 'wp_cache_get_multiple' ) ) : 12 /** 13 * Retrieves multiple values from the cache in one call. 14 * 15 * Compat function to mimic wp_cache_get_multiple(). 16 * 17 * @ignore 18 * @since 5.5.0 19 * 20 * @see wp_cache_get_multiple() 21 * 22 * @param array $keys Array of keys under which the cache contents are stored. 23 * @param string $group Optional. Where the cache contents are grouped. Default empty. 24 * @param bool $force Optional. Whether to force an update of the local cache 25 * from the persistent cache. Default false. 26 * @return array Array of values organized into groups. 27 */ 28 function wp_cache_get_multiple( $keys, $group = '', $force = false ) { 29 $values = array(); 30 31 foreach ( $keys as $key ) { 32 $values[ $key ] = wp_cache_get( $key, $group, $force ); 33 } 34 35 return $values; 36 } 37 endif;