Docs: Improve @return tags for wp_cache_*_multiple() functions:

* `wp_cache_add_multiple()`
* `wp_cache_set_multiple()`
* `wp_cache_get_multiple()`
* `wp_cache_delete_multiple()`

This aims to provide more details about the returned value types.

Follow-up to [52700], [52702], [52703].

See , .

git-svn-id: https://develop.svn.wordpress.org/trunk@52708 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-02-11 19:19:57 +00:00
parent deafd1193c
commit d3851cd248
3 changed files with 23 additions and 12 deletions

@ -23,7 +23,8 @@ if ( ! function_exists( 'wp_cache_add_multiple' ) ) :
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration).
* @return array Array of return values.
* @return bool[] Array of return values, grouped by key. Each value is either
* true on success, or false if cache key and group already exist.
*/
function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) {
$values = array();
@ -53,7 +54,8 @@ if ( ! function_exists( 'wp_cache_set_multiple' ) ) :
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration).
* @return array Array of return values.
* @return bool[] Array of return values, grouped by key. Each value is either
* true on success, or false on failure.
*/
function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) {
$values = array();
@ -81,7 +83,8 @@ if ( ! function_exists( 'wp_cache_get_multiple' ) ) :
* @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 return values, grouped by key. Each value is either
* the cache contents on success, or false on failure.
*/
function wp_cache_get_multiple( $keys, $group = '', $force = false ) {
$values = array();
@ -107,7 +110,8 @@ if ( ! function_exists( 'wp_cache_delete_multiple' ) ) :
*
* @param array $keys Array of keys under which the cache to deleted.
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @return array Array of return values.
* @return bool[] Array of return values, grouped by key. Each value is either
* true on success, or false if the contents were not deleted.
*/
function wp_cache_delete_multiple( array $keys, $group = '' ) {
$values = array();

@ -56,7 +56,8 @@ function wp_cache_add( $key, $data, $group = '', $expire = 0 ) {
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration).
* @return array Array of return values.
* @return bool[] Array of return values, grouped by key. Each value is either
* true on success, or false if cache key and group already exist.
*/
function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) {
global $wp_object_cache;
@ -122,7 +123,8 @@ function wp_cache_set( $key, $data, $group = '', $expire = 0 ) {
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration).
* @return array Array of return values.
* @return bool[] Array of return values, grouped by key. Each value is either
* true on success, or false on failure.
*/
function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) {
global $wp_object_cache;
@ -164,7 +166,8 @@ function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
* @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 return values, grouped by key. Each value is either
* the cache contents on success, or false on failure.
*/
function wp_cache_get_multiple( $keys, $group = '', $force = false ) {
global $wp_object_cache;
@ -200,7 +203,8 @@ function wp_cache_delete( $key, $group = '' ) {
*
* @param array $keys Array of keys under which the cache to deleted.
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @return array Array of return values.
* @return bool[] Array of return values, grouped by key. Each value is either
* true on success, or false if the contents were not deleted.
*/
function wp_cache_delete_multiple( array $keys, $group = '' ) {
global $wp_object_cache;

@ -188,7 +188,8 @@ class WP_Object_Cache {
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration).
* @return array Array of return values.
* @return bool[] Array of return values, grouped by key. Each value is either
* true on success, or false if cache key and group already exist.
*/
public function add_multiple( array $data, $group = '', $expire = 0 ) {
$values = array();
@ -277,7 +278,7 @@ class WP_Object_Cache {
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration).
* @return array Array of return values.
* @return bool[] Array of return values, grouped by key. Each value is always true.
*/
public function set_multiple( array $data, $group = '', $expire = 0 ) {
$values = array();
@ -341,7 +342,8 @@ class WP_Object_Cache {
* @param string $group Optional. Where the cache contents are grouped. Default 'default'.
* @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 return values, grouped by key. Each value is either
* the cache contents on success, or false on failure.
*/
public function get_multiple( $keys, $group = 'default', $force = false ) {
$values = array();
@ -389,7 +391,8 @@ class WP_Object_Cache {
*
* @param array $keys Array of keys to be deleted.
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @return array Array of return values.
* @return bool[] Array of return values, grouped by key. Each value is either
* true on success, or false if the contents were not deleted.
*/
public function delete_multiple( array $keys, $group = '' ) {
$values = array();