mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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:
@@ -331,25 +331,6 @@ class Tests_Cache extends WP_UnitTestCase {
|
||||
$this->assertFalse( wp_cache_get( $fake_key ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 20875
|
||||
*/
|
||||
public function test_get_multiple() {
|
||||
wp_cache_set( 'foo1', 'bar', 'group1' );
|
||||
wp_cache_set( 'foo2', 'bar', 'group1' );
|
||||
wp_cache_set( 'foo1', 'bar', 'group2' );
|
||||
|
||||
$found = wp_cache_get_multiple( array( 'foo1', 'foo2', 'foo3' ), 'group1' );
|
||||
|
||||
$expected = array(
|
||||
'foo1' => 'bar',
|
||||
'foo2' => 'bar',
|
||||
'foo3' => false,
|
||||
);
|
||||
|
||||
$this->assertSame( $expected, $found );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 54574
|
||||
*/
|
||||
@@ -394,6 +375,25 @@ class Tests_Cache extends WP_UnitTestCase {
|
||||
$this->assertSame( $expected, $found );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 20875
|
||||
*/
|
||||
public function test_wp_cache_get_multiple() {
|
||||
wp_cache_set( 'foo1', 'bar', 'group1' );
|
||||
wp_cache_set( 'foo2', 'bar', 'group1' );
|
||||
wp_cache_set( 'foo1', 'bar', 'group2' );
|
||||
|
||||
$found = wp_cache_get_multiple( array( 'foo1', 'foo2', 'foo3' ), 'group1' );
|
||||
|
||||
$expected = array(
|
||||
'foo1' => 'bar',
|
||||
'foo2' => 'bar',
|
||||
'foo3' => false,
|
||||
);
|
||||
|
||||
$this->assertSame( $expected, $found );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 54574
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user