Force memcached to write to all servers in pool
Posted
by Industrial
on Stack Overflow
See other posts from Stack Overflow
or by Industrial
Published on 2010-05-23T21:31:33Z
Indexed on
2010/05/23
22:21 UTC
Read the original article
Hit count: 178
Hi everyone,
I have thought a bit on how to make sure that a particular key is distributed to ALL memcached servers in a pool.
My current, untested solution is to make another instance of memcached, something like this:
$cluster['local'] = array('host' => '192.168.1.1', 'port' => '11211', 'weight' => 50);
foreach ($this->cluster() as $cluster) {
@$this->tempMemcache = new Memcache;
@$this->tempMemcache->connect($cluster['host'], $cluster['port']);
@$this->tempMemcache->set($key, $value, $this->compress, $expireTime);
@$this->tempMemcache->close();
}
What is common sense to do in this case, when certain keys need to be stored on ALL servers for reliability?
© Stack Overflow or respective owner