>  This is a confusing distinction.  Basically, you need your connection
> factory to return a net.spy.memcached.KetamaNodeLocator as the locator.  The
> hash algorithm is independent of that.

Thanks Dustin.

It's not so much that the distinction is confusing--I immediately saw
the KetamaNodeLocator class when I first glanced at the API. What *is*
confusing is that the API offers no hints about how to set the type of
NodeLocator to use. So, I assumed that using the hash also switches
internally the factory to use the KetamaNodeLocator.

Regardless, your post inspired me to keep experimenting and I figured
out the following code which does produce only 10% cache disruption,
which is exactly what I initially hoped for.

ConnectionFactory connectionFactory = new DefaultConnectionFactory(
                                DefaultConnectionFactory.DEFAULT_OP_QUEUE_LEN,
                                
DefaultConnectionFactory.DEFAULT_READ_BUFFER_SIZE,
                                HashAlgorithm.KETAMA_HASH) {
                        public NodeLocator createLocator(List<MemcachedNode> 
list) {
                                KetamaNodeLocator locator = new 
KetamaNodeLocator(list,
HashAlgorithm.KETAMA_HASH);
                                return locator;
                        }
                };

Thanks,
Dave

Reply via email to