Sin descripción

cache-compat.php 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. if ( ! function_exists( 'wp_cache_get_multiple' ) ) :
  11. /**
  12. * Retrieves multiple values from the cache in one call.
  13. *
  14. * Compat function to mimic wp_cache_get_multiple().
  15. *
  16. * @ignore
  17. * @since 5.5.0
  18. *
  19. * @see wp_cache_get_multiple()
  20. *
  21. * @param array $keys Array of keys under which the cache contents are stored.
  22. * @param string $group Optional. Where the cache contents are grouped. Default empty.
  23. * @param bool $force Optional. Whether to force an update of the local cache
  24. * from the persistent cache. Default false.
  25. * @return array Array of values organized into groups.
  26. */
  27. function wp_cache_get_multiple( $keys, $group = '', $force = false ) {
  28. $values = array();
  29. foreach ( $keys as $key ) {
  30. $values[ $key ] = wp_cache_get( $key, $group, $force );
  31. }
  32. return $values;
  33. }
  34. endif;