Docs: Add missing documentation for the $group parameter of WP_Object_Cache::get_multiple().

Synchronize documentation between `wp_cache_get_multiple()`, its compat version, and the class method.

See #20875.

git-svn-id: https://develop.svn.wordpress.org/trunk@47944 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-06-10 09:55:56 +00:00
parent ddf897db05
commit 4d506a300f
3 changed files with 32 additions and 30 deletions

View File

@ -10,21 +10,22 @@
if ( ! function_exists( 'wp_cache_get_multiple' ) ) : if ( ! function_exists( 'wp_cache_get_multiple' ) ) :
/** /**
* Compat function to mimic wp_cache_get_multiple. * Retrieves multiple values from the cache in one call.
* Retrieves multiple values from the cache. *
* Compat function to mimic wp_cache_get_multiple().
* *
* @ignore * @ignore
* @since 5.5.0 * @since 5.5.0
* *
* @see wp_cache_get_multiple() * @see wp_cache_get_multiple()
* *
* @param array $keys Array of keys to fetch. * @param array $keys Array of keys under which the cache contents are stored.
* @param bool $force Optional. Unused. Whether to force a refetch rather than relying on the local * @param string $group Optional. Where the cache contents are grouped. Default empty.
* cache. Default false. * @param bool $force Optional. Whether to force an update of the local cache
* * from the persistent cache. Default false.
* @return array Array of values organized into groups. * @return array Array of values organized into groups.
*/ */
function wp_cache_get_multiple( $keys, $group = 'default', $force = false ) { function wp_cache_get_multiple( $keys, $group = '', $force = false ) {
$values = array(); $values = array();
foreach ( $keys as $key ) { foreach ( $keys as $key ) {

View File

@ -113,12 +113,11 @@ function wp_cache_flush() {
* *
* @param int|string $key The key under which the cache contents are stored. * @param int|string $key The key under which the cache contents are stored.
* @param string $group Optional. Where the cache contents are grouped. Default empty. * @param string $group Optional. Where the cache contents are grouped. Default empty.
* @param bool $force Optional. Whether to force an update of the local cache from the persistent * @param bool $force Optional. Whether to force an update of the local cache
* cache. Default false. * from the persistent cache. Default false.
* @param bool $found Optional. Whether the key was found in the cache (passed by reference). * @param bool $found Optional. Whether the key was found in the cache (passed by reference).
* Disambiguates a return of false, a storable value. Default null. * Disambiguates a return of false, a storable value. Default null.
* @return bool|mixed False on failure to retrieve contents or the cache * @return mixed|false The cache contents on success, false on failure to retrieve contents.
* contents on success
*/ */
function wp_cache_get( $key, $group = '', $force = false, &$found = null ) { function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
global $wp_object_cache; global $wp_object_cache;
@ -127,16 +126,18 @@ function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
} }
/** /**
* Gets multiple values from cache in one call. * Retrieves multiple values from the cache in one call.
* *
* @since 5.5.0 * @since 5.5.0
* @see WP_Object_Cache::get_multiple()
* *
* @param array $keys Array of keys to get from group. * @see WP_Object_Cache::get_multiple()
* @param string $group Optional. Where the cache contents are grouped. Default empty. * @global WP_Object_Cache $wp_object_cache Object cache global instance.
* @param bool $force Optional. Whether to force an update of the local cache from the persistent *
* cache. Default false. * @param array $keys Array of keys under which the cache contents are stored.
* @return array|bool Array of values. * @param string $group Optional. Where the cache contents are grouped. Default empty.
* @param bool $force Optional. Whether to force an update of the local cache
* from the persistent cache. Default false.
* @return array Array of values organized into groups.
*/ */
function wp_cache_get_multiple( $keys, $group = '', $force = false ) { function wp_cache_get_multiple( $keys, $group = '', $force = false ) {
global $wp_object_cache; global $wp_object_cache;

View File

@ -270,12 +270,12 @@ class WP_Object_Cache {
* *
* @since 2.0.0 * @since 2.0.0
* *
* @param int|string $key What the contents in the cache are called. * @param int|string $key The key under which the cache contents are stored.
* @param string $group Optional. Where the cache contents are grouped. Default 'default'. * @param string $group Optional. Where the cache contents are grouped. Default 'default'.
* @param bool $force Optional. Unused. Whether to force a refetch rather than relying on the local * @param bool $force Optional. Unused. Whether to force an update of the local cache
* cache. Default false. * from the persistent cache. Default false.
* @param bool $found Optional. Whether the key was found in the cache (passed by reference). * @param bool $found Optional. Whether the key was found in the cache (passed by reference).
* Disambiguates a return of false, a storable value. Default null. * Disambiguates a return of false, a storable value. Default null.
* @return mixed|false The cache contents on success, false on failure to retrieve contents. * @return mixed|false The cache contents on success, false on failure to retrieve contents.
*/ */
public function get( $key, $group = 'default', $force = false, &$found = null ) { public function get( $key, $group = 'default', $force = false, &$found = null ) {
@ -303,14 +303,14 @@ class WP_Object_Cache {
} }
/** /**
* Retrieves multiple values from the cache. * Retrieves multiple values from the cache in one call.
* *
* @since 5.5.0 * @since 5.5.0
*
* @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.
* *
* @param array $keys Array of keys under which the cache contents are stored.
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @param bool $force Optional. Whether to force an update of the local cache
* from the persistent cache. Default false.
* @return array Array of values organized into groups. * @return array Array of values organized into groups.
*/ */
public function get_multiple( $keys, $group = 'default', $force = false ) { public function get_multiple( $keys, $group = 'default', $force = false ) {