If you're using multiple get in the cachr API you're likely using multiple
get for the objects on cache misses too. In which case you want a list of
IDs to retrieve at once, not fetching one at a time.
On 7 Sep 2013 22:49, "Robert Hafner" <notifications@github.com> wrote:

> In proposed/cache.md:
>
> > +     *   If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
> > +     *   MUST be thrown.
> > +     */
> > +    function getItem($key);
> > +
> > +    /**
> > +     * Returns a traversable set of cache items.
> > +     *
> > +     * @param array $keys
> > +     *   An indexed array of keys of items to retrieve.
> > +     * @return \Traversable
> > +     *   A traversable collection of Cache Items in the same order as the $keys
> > +     *   parameter, keyed by the cache keys of each item. If no items are found
> > +     *   an empty Traversable collection will be returned.
> > +     */
> > +    function getItems(array $keys);
>
> The idea behind this method was that you'd only have to iterate through
> one thing, the collection of items, and you'd have everything you'd need to
> either use the value or regenerate and store it.
>
> $items = $pool->getItems($keys);
> foreach($items as $keys => $item){
>    if($item->isHit())
>    {
>       $value = $item->get();
>    }else{
>       $value = runExpensiveFunction($key);
>       $item->set($value);
>    }}
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/php-fig/fig-standards/pull/149/files#r6225927>
> .
>