Make WordPress Core

Ticket #20875: 20875.2.diff

File 20875.2.diff, 2.4 KB (added by wonderboymusic, 13 years ago)
  • wp-includes/cache.php

    diff --git wp-includes/cache.php wp-includes/cache.php
    index af1c2ad..a9e2c19 100644
    function wp_cache_get( $key, $group = '', $force = false, &$found = null ) { 
    114114}
    115115
    116116/**
     117 * Gets multiple values from cache in one call.
     118 *
     119 * Key/group association is handled by assuming all keys have the same group
     120 * if string or single value array is passed as the 'groups' value. If 'groups'
     121 * is an array with more than 1 value, then groups[n] corresponds with keys[n].
     122 * If there are more 'keys' values then 'groups' values, remaining keys will be
     123 * pulled from the 'default' group.
     124 *
     125 * @since 3.6
     126 * @uses $wp_object_cache Object Cache Class
     127 * @see WP_Object_Cache::get_multi()
     128 *
     129 * @param mixed $keys Array of keys associated with values.
     130 * @param mixed $groups Array of groups associated with keys.
     131 * @return array|bool Array of values organized into groups.
     132 */
     133function wp_cache_get_multi( $keys, $groups = '' ) {
     134        global $wp_object_cache;
     135
     136        return $wp_object_cache->get_multi( $keys, $groups );
     137}
     138
     139/**
    117140 * Increment numeric cache item's value
    118141 *
    119142 * @since 3.3.0
    class WP_Object_Cache { 
    465488        }
    466489
    467490        /**
     491         * Gets multiple values from cache in one call.
     492         *
     493         * Key/group association is handled by assuming all keys have the same group
     494         * if string or single value array is passed as the 'groups' value. If 'groups'
     495         * is an array with more than 1 value, then groups[n] corresponds with keys[n].
     496         * If there are more 'keys' values then 'groups' values, remaining keys will be
     497         * pulled from the 'default' group.
     498         *
     499         * @since 3.6
     500         *
     501         * @param mixed $keys Keys associated with values.
     502         * @param mixed $groups Groups associated with keys.
     503         * @return array|bool Array of values
     504         */
     505        function get_multi( $keys, $groups = 'default' ) {
     506                $values = array();
     507                $keys = array_values( (array) $keys );
     508
     509                if ( is_array( $groups ) )
     510                        $groups = array_values( $groups );
     511
     512                foreach ( $keys as $key ) {
     513                        if ( empty( $groups ) ) {
     514                                $values[] = $this->get( $key );
     515                        } elseif ( ! is_array( $groups )  ) {
     516                                $values[] = $this->get( $key, $groups );
     517                        } else {
     518                                $group = array_shift( $groups );
     519                                if ( $group )
     520                                        $values[] = $this->get( $key, $group );
     521                                else
     522                                        $values[] = $this->get( $key );
     523                        }
     524                }
     525
     526                return $values;
     527        }
     528
     529        /**
    468530         * Increment numeric cache item's value
    469531         *
    470532         * @since 3.3.0