Wednesday, April 23, 2008

Memcache Trick

i was faced with a very weird behaviour while working with memcache-client with two memcache servers

first lets look of my configuration to the client in order to explain on it
On my first server

memcache_options = {
((some options)
}
CACHE = MemCache.new memcache_options
CACHE.servers = [((SERVER1)), ((SERVER2))]


On my second server

memcache_options = {
((some options)
}
CACHE = MemCache.new memcache_options
CACHE.servers = [((SERVER2)), ((SERVER1))]


after running both servers, i noticed that what i enter in memcache on that server isn't available to the other server

Where is the problem??

here it is, a very strange reason

CACHE.servers = [((SERVER2)), ((SERVER1))]
CACHE.servers = [((SERVER1)), ((SERVER2))]


this is the problem, one uses SERVER1 then SERVER2
other uses SERVER2 then SERVER1

i thought that memcache client when checking for a key, he looks at the first, if not found then looks at the second then say it is a miss
but i realized that if it isn't on the first then it doesn't look at the second

That's it, just take care, cuz small things can waste your time and energy looking after their reasons

No comments: