mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-08 22:54:36 +00:00
Cache API: Introduce wp_cache_get_multi().
Many caching backend have support for multiple gets in a single request. This brings that support to core, with a compatability fallback that will loop over requests if needed. Fixes: #20875. Props: nacin, tollmanz, wonderboymusic, ryan, jeremyfelt, spacedmonkey, boonebgorges, dd32, rmccue, ocean90, jipmoors, johnjamesjacoby, tillkruess, donmhico, davidbaumwald, SergeyBiryukov, whyisjake. git-svn-id: https://develop.svn.wordpress.org/trunk@47938 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -315,4 +315,23 @@ class Tests_Cache extends WP_UnitTestCase {
|
||||
// Make sure $fake_key is not stored.
|
||||
$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 );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user