Cache API: Reorder object cache functions and methods for consistency.

The original order was alphabetical, which became less obvious as newer functions got added, resulting in a somewhat random order.

This commits aims to organize the functions and related `WP_Object_Cache` methods in a more predictable order:

* `wp_cache_init()`
* `wp_cache_add()`
* `wp_cache_add_multiple()`
* `wp_cache_replace()`
* `wp_cache_set()`
* `wp_cache_set_multiple()`
* `wp_cache_get()`
* `wp_cache_get_multiple()`
* `wp_cache_delete()`
* `wp_cache_delete_multiple()`
* `wp_cache_incr()`
* `wp_cache_decr()`
* `wp_cache_flush()`
* `wp_cache_close()`
* `wp_cache_add_global_groups()`
* `wp_cache_add_non_persistent_groups()`
* `wp_cache_switch_to_blog()`
* `wp_cache_reset()`

Follow-up to [3011], [6543], [7986], [13066], [18580], [21403], [47938], [52700], [52703-52705].

See #54728, #54574.

git-svn-id: https://develop.svn.wordpress.org/trunk@52706 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-02-11 18:47:38 +00:00
parent 72cf1aa905
commit 5d7297d031
5 changed files with 484 additions and 485 deletions

View File

@@ -267,54 +267,18 @@ class Tests_Pluggable extends WP_UnitTestCase {
array(
// wp-includes/cache.php:
'wp_cache_init' => array(),
'wp_cache_add' => array(
'key',
'data',
'group' => '',
'expire' => 0,
),
'wp_cache_close' => array(),
'wp_cache_decr' => array(
'key',
'offset' => 1,
'group' => '',
),
'wp_cache_delete' => array(
'key',
'group' => '',
),
'wp_cache_flush' => array(),
'wp_cache_get' => array(
'key',
'group' => '',
'force' => false,
'found' => null,
),
'wp_cache_get_multiple' => array(
'keys',
'group' => '',
'force' => false,
),
'wp_cache_set_multiple' => array(
'data',
'group' => '',
'expire' => 0,
),
'wp_cache_add_multiple' => array(
'data',
'group' => '',
'expire' => 0,
),
'wp_cache_delete_multiple' => array(
'keys',
'group' => '',
),
'wp_cache_incr' => array(
'key',
'offset' => 1,
'group' => '',
),
'wp_cache_init' => array(),
'wp_cache_replace' => array(
'key',
'data',
@@ -327,9 +291,45 @@ class Tests_Pluggable extends WP_UnitTestCase {
'group' => '',
'expire' => 0,
),
'wp_cache_switch_to_blog' => array( 'blog_id' ),
'wp_cache_set_multiple' => array(
'data',
'group' => '',
'expire' => 0,
),
'wp_cache_get' => array(
'key',
'group' => '',
'force' => false,
'found' => null,
),
'wp_cache_get_multiple' => array(
'keys',
'group' => '',
'force' => false,
),
'wp_cache_delete' => array(
'key',
'group' => '',
),
'wp_cache_delete_multiple' => array(
'keys',
'group' => '',
),
'wp_cache_incr' => array(
'key',
'offset' => 1,
'group' => '',
),
'wp_cache_decr' => array(
'key',
'offset' => 1,
'group' => '',
),
'wp_cache_flush' => array(),
'wp_cache_close' => array(),
'wp_cache_add_global_groups' => array( 'groups' ),
'wp_cache_add_non_persistent_groups' => array( 'groups' ),
'wp_cache_switch_to_blog' => array( 'blog_id' ),
'wp_cache_reset' => array(),
)
);