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 #54729, #54574.
Built from https://develop.svn.wordpress.org/trunk@52708


git-svn-id: http://core.svn.wordpress.org/trunk@52297 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-02-11 19:21:01 +00:00
parent a4026420cc
commit 11691e8207
4 changed files with 24 additions and 13 deletions

View File

@ -23,7 +23,8 @@ if ( ! function_exists( 'wp_cache_add_multiple' ) ) :
* @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 int $expire Optional. When to expire the cache contents, in seconds. * @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration). * 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 ) { function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) {
$values = array(); $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 string $group Optional. Where the cache contents are grouped. Default empty.
* @param int $expire Optional. When to expire the cache contents, in seconds. * @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration). * 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 ) { function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) {
$values = array(); $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 string $group Optional. Where the cache contents are grouped. Default empty.
* @param bool $force Optional. Whether to force an update of the local cache * @param bool $force Optional. Whether to force an update of the local cache
* from the persistent cache. Default false. * 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 ) { function wp_cache_get_multiple( $keys, $group = '', $force = false ) {
$values = array(); $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 array $keys Array of keys under which the cache to deleted.
* @param string $group Optional. Where the cache contents are grouped. Default empty. * @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 = '' ) { function wp_cache_delete_multiple( array $keys, $group = '' ) {
$values = array(); $values = array();

View File

@ -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 string $group Optional. Where the cache contents are grouped. Default empty.
* @param int $expire Optional. When to expire the cache contents, in seconds. * @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration). * 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 ) { function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) {
global $wp_object_cache; 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 string $group Optional. Where the cache contents are grouped. Default empty.
* @param int $expire Optional. When to expire the cache contents, in seconds. * @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration). * 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 ) { function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) {
global $wp_object_cache; 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 string $group Optional. Where the cache contents are grouped. Default empty.
* @param bool $force Optional. Whether to force an update of the local cache * @param bool $force Optional. Whether to force an update of the local cache
* from the persistent cache. Default false. * 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 ) { function wp_cache_get_multiple( $keys, $group = '', $force = false ) {
global $wp_object_cache; 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 array $keys Array of keys under which the cache to deleted.
* @param string $group Optional. Where the cache contents are grouped. Default empty. * @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 = '' ) { function wp_cache_delete_multiple( array $keys, $group = '' ) {
global $wp_object_cache; global $wp_object_cache;

View File

@ -188,7 +188,8 @@ class WP_Object_Cache {
* @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 int $expire Optional. When to expire the cache contents, in seconds. * @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration). * 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 ) { public function add_multiple( array $data, $group = '', $expire = 0 ) {
$values = array(); $values = array();
@ -277,7 +278,7 @@ class WP_Object_Cache {
* @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 int $expire Optional. When to expire the cache contents, in seconds. * @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration). * 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 ) { public function set_multiple( array $data, $group = '', $expire = 0 ) {
$values = array(); $values = array();
@ -341,7 +342,8 @@ class WP_Object_Cache {
* @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. Whether to force an update of the local cache * @param bool $force Optional. Whether to force an update of the local cache
* from the persistent cache. Default false. * 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 ) { public function get_multiple( $keys, $group = 'default', $force = false ) {
$values = array(); $values = array();
@ -389,7 +391,8 @@ class WP_Object_Cache {
* *
* @param array $keys Array of keys to be deleted. * @param array $keys Array of keys to be deleted.
* @param string $group Optional. Where the cache contents are grouped. Default empty. * @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 = '' ) { public function delete_multiple( array $keys, $group = '' ) {
$values = array(); $values = array();

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.0-alpha-52707'; $wp_version = '6.0-alpha-52708';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.