Memcached::getMulti

Description

Memcached::getMulti() is similar to
Memcached::get(), but instead of a single key
item, it retrieves multiple items the keys of which are specified in the
keys array. If cas_tokens
variable is provided, it is filled with the CAS token values for the found
items.

Note:

Unlike Memcached::get() it is not possible to
specify a read-through cache callback for
Memcached::getMulti(), because the memcache protocol
does not provide information on which keys were not found in the multi-key
request.

The flags parameter can be used to specify
additional options for Memcached::getMulti(). Currently,
the only available option is
Memcached::GET_PRESERVE_ORDER that ensures that the
keys are returned in the same order as they were requested in.

User Contributed Notes 1 note

GOTCHA: Recently I was tasked with moving from PECL memcache to PECL memcached and ran into a major problem -- memcache and memcached serialize data differently, meaning that data written with one library can't necessarily be read with the other library.

For example, If you write an object or an array with memcache, it's interpreted as an integer by memcached. If you write it with memcached, it's interpreted as a string by memcache.

tl;dr - You can't safely switch between memcache and memcached without a either a cache flush or isolated cache environments.