I got a sample Script which looks nearly like this:
$memcache = new Memcache;
$memcache->addServer('memcache_host', 11211);
$memcache->addServer('memcache_host2', 11211);
If i use now
$memcache->set('var_key', 'some really big variable');
The key get/value get stored (only on one server), of course. But when i reorder the Memcache Serverlist, its recreating the cache. I noticed it always use the second Server… But why?
I just want to know and understand, how the hash for storage gets generated.
And which factors are relevant for the hash and server selection?
I could not find anything about.
Regards!
The Answer is:
So in my case, i got 2 Servers with the Sample Key “var_key”.
As we can see, the following factors are relevant:
That’s the way how the server gets chosen, for standard hash strategy.