Hey,

There's no interface to do that directly. The easiest would be to stop using pools and create one client instance per memcached... then have your app pick one to send to.

But really, that's hella dangerous. Probably the wrong approach here.

The difference between those commands is that the _by_key() ones use a secondary key to hash against the server list. So:

'masterkey:5', 'datakey:1', 'value'

... 'masterkey:5' is used to hash against the server list instead of 'datakey:1'. Then 'datakey:1' is stored in that particular server as the actual key, and not 'masterkey:5'. It's so you could cluster, say, all of a particular user's data on a particular (but arbitrary) memcached instance, and are then able to fetch it all back in one roundtrip via multiget.

-Dormando

On Tue, 16 Dec 2008, Jitendra wrote:


Hi All,

I would like to set a key-value pair to a specific instance of
memcached. For my data I have 10 instances of memcached running. I
tried with memcached_set_by_key(), memcached_get_by_key() to set and
get the key-value, with the master key as (serverip+port). But it is
not working as desired. I guess I am wrong somewhere.

May I know what is the difference between the following APIs.
memcached_set(), memcached_set_by_key()
memcached_get(), memcached_get_by_key()
I guess both are functionally same, isn't it ?
Thanks in advance for any response.

Regards
Jitendra

Reply via email to