i guess you could do it this way  - may be slow though as its not
asyncronous so has to write to all instances.

No matter what you do using @ operator is a very bad idea. this is how
undetectable bugs happen, id check for response and throw exception if error
is important.

if you have many servers would probably be much more efficient to have some
kind of consistent hashing function so that each key would be saved into 2
servers only. You will not have multiple failures unless you have tons of
servers. Then you save each key in 2 servers not N, makes save much much
faster and saves you space.

regards

art

On 23 May 2010 23:11, Jay <[email protected]> wrote:

> 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. I have yet found no
> good solution.
>
> 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?
>

Reply via email to