Memcached::getMulti

Beschreibung

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.

Hinweis:

Before v3.0 a second argument &cas_tokens was in use.
It was filled with the CAS token values for the found items.
The &cas_tokens parameter was removed in v3.0 of the extension.
It was replaced with a new flag Memcached::GET_EXTENDED
that needs is to be used as the value for flags.

The flags parameter can be used to specify
additional options for Memcached::getMulti().
Memcached::GET_PRESERVE_ORDER ensures that the
keys are returned in the same order as they were requested in.
Memcached::GET_EXTENDED ensures that the
CAS tokens will be fetched too.

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.