Cacheing multiget

Can we get something like multiget in the caching component while some caching servers or methods may not have anything similar to memcache's they could fake it by performing multiple gets and returning an aggregated result.

Could you explain that better and give usage examples ?

For memcached you can pass an array of keys that can be fetched all at once.

An example use would be if you cache a number of records from a search and then wanted to fetch them all in one call from cache rather than one at a time.

Also for memcached it's more efficient to do a bulk get of items when you can

while a number of caching methods may not have the abilty to fetch

multiple items it could be handled in php by just looping and collecting the results.

This would be quite simple by extending whatever cache you want, f. ex:

class MyFileCache extends CFileCache {


    function getValue($key) {


        if (!is_array($key)) {


            return parent::getValue($key);


        } else {


            $collection = array();


            foreach ($key as $value) {


                $collection[$key] = parent::getValue($key);


            }


            return $collection;


         }


    }


}


But i don't know - perhaps it would be useful to have it in the core implementation ?

Yeah I know i could extend the class to get add it but it would be nice to have the functions in the core.

I'm not sure if we should implement this in the core, since it seems only memcache supports this.

FYI, you could still access this feature with the current release via Yii::app()->cache->memCache