Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MemcacheEx - Memcache extension to support setMulti and getMulti methods
class MemcacheEx extends Memcache
public function getMulti($keys)
$results = array();
if ($keys) {
foreach ($keys as $key) {
$cache = parent::get($key);
if ($cache !== false) {
$results[$key] = $cache;
return $results;
public function setMulti($vars, $expire = 0, $flag = MEMCACHE_COMPRESSED)
foreach ($vars as $key => $value) {
parent::set($key, $value, $flag, $expire);

This comment has been minimized.

Copy link
Owner Author

commented Feb 16, 2011

All credits for:

getMulti($keys); $memcache->getMulti($vars);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.