views:

343

answers:

1

Hi!

Just like the title, how would a multiget from memcache look like?

Is this the correct way of utilizing multiget? :

$memcache_obj = new Memcache;
$memcache_obj->connect('memcache_host', 11211);
$var = $memcache_obj->get(Array('some_key', 'second_key'));

Thanks

UPDATE: anyone looking to do the same, check out this addition as well: http://www.craigiam.com/blog/19/memcached-multiget-using-php-pecl-memcache-class

Big thanks to Pascal_Martin for solving the issue!

+3  A: 

Considering that Memcache::get accepts, as its first parameter, either one key, or an array of keys, I'd say it is ;-)


Quoting :

You can pass array of keys to Memcache::get() to get array of values.
The result array will contain only found key-value pairs.

Pascal MARTIN
Hi Martin, thanks a lot. You're the man as usual :)
Industrial