IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 123 | 123 | return $wp_object_cache->get( $key, $group, $force, $found ); |
| 124 | 124 | } |
| 125 | 125 | |
| | 126 | /** |
| | 127 | * Gets multiple values from cache in one call. |
| | 128 | * |
| | 129 | * @since 5.4.0 |
| | 130 | * @uses $wp_object_cache Object Cache Class |
| | 131 | * |
| | 132 | * @param array $keys array of keys to get from group. |
| | 133 | * @param string $group Optional. Where the cache contents are grouped. Default empty. |
| | 134 | * @param bool $force Optional. Whether to force an update of the local cache from the persistent |
| | 135 | * cache. Default false.* |
| | 136 | * @return array|bool Array of values. |
| | 137 | */ |
| | 138 | function wp_cache_multiple_get( $keys, $group = '', $force = false ) { |
| | 139 | global $wp_object_cache; |
| | 140 | |
| | 141 | return $wp_object_cache->get_multiple( $keys, $group, $force ); |
| | 142 | } |
| | 143 | |
| 126 | 144 | /** |
| 127 | 145 | * Increment numeric cache item's value |
| 128 | 146 | * |
| … |
… |
|
| 556 | 574 | return false; |
| 557 | 575 | } |
| 558 | 576 | |
| | 577 | /** |
| | 578 | * Retrieves multiple values from the cache. |
| | 579 | * |
| | 580 | * @since 5.4.0 |
| | 581 | * |
| | 582 | * @param array $keys Array of keys to fetch. |
| | 583 | * @param bool $force Optional. Unused. Whether to force a refetch rather than relying on the local |
| | 584 | * cache. Default false. |
| | 585 | * |
| | 586 | * @return array Array of values organized into groups. |
| | 587 | */ |
| | 588 | public function get_multiple( $keys, $group = 'default', $force = false ) { |
| | 589 | $values = array(); |
| | 590 | |
| | 591 | foreach ( $keys as $key ) { |
| | 592 | $values[ $key ] = $this->get( $key, $group, $force ); |
| | 593 | } |
| | 594 | |
| | 595 | return $values; |
| | 596 | } |
| | 597 | |
| 559 | 598 | /** |
| 560 | 599 | * Increments numeric cache item's value. |
| 561 | 600 | * |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 613 | 613 | wp_redirect( $link ); |
| 614 | 614 | die(); |
| 615 | 615 | } |
| | 616 | |
| | 617 | if ( ! function_exists( 'wp_cache_multiple_get' ) ) { |
| | 618 | require_once( ABSPATH . WPINC . '/cache-compat.php' ); |
| | 619 | } |
| 616 | 620 | } |
| 617 | 621 | |
| 618 | 622 | /** |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 315 | 315 | // Make sure $fake_key is not stored |
| 316 | 316 | $this->assertFalse( wp_cache_get( $fake_key ) ); |
| 317 | 317 | } |
| | 318 | |
| | 319 | /** |
| | 320 | * @ticket 20875 |
| | 321 | */ |
| | 322 | public function test_get_multiple() { |
| | 323 | wp_cache_set( 'foo1', 'bar', 'group1' ); |
| | 324 | wp_cache_set( 'foo2', 'bar', 'group1' ); |
| | 325 | wp_cache_set( 'foo1', 'bar', 'group2' ); |
| | 326 | |
| | 327 | $found = wp_cache_multiple_get( array( 'foo1', 'foo2', 'foo3', ), 'group1' ); |
| | 328 | |
| | 329 | $expected = array( |
| | 330 | 'foo1' => 'bar', |
| | 331 | 'foo2' => 'bar', |
| | 332 | 'foo3' => false, |
| | 333 | ); |
| | 334 | |
| | 335 | $this->assertSame( $expected, $found ); |
| | 336 | } |
| 318 | 337 | } |