|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.spy.memcached.compat.SpyObject net.spy.memcached.KetamaNodeLocator
public final class KetamaNodeLocator
This is an implementation of the Ketama consistent hash strategy from last.fm. This implementation may not be compatible with libketama as hashing is considered separate from node location. Note that this implementation does not currently supported weighted nodes.
Constructor Summary | |
---|---|
KetamaNodeLocator(List<MemcachedNode> nodes,
HashAlgorithm alg)
|
|
KetamaNodeLocator(List<MemcachedNode> nodes,
HashAlgorithm alg,
KetamaNodeLocatorConfiguration conf)
|
Method Summary | |
---|---|
Collection<MemcachedNode> |
getAll()
Get all memcached nodes. |
MemcachedNode |
getPrimary(String k)
Get the primary location for the given key. |
NodeLocator |
getReadonlyCopy()
Create a read-only copy of this NodeLocator. |
Iterator<MemcachedNode> |
getSequence(String k)
Get an iterator over the sequence of nodes that make up the backup locations for a given key. |
Methods inherited from class net.spy.memcached.compat.SpyObject |
---|
getLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KetamaNodeLocator(List<MemcachedNode> nodes, HashAlgorithm alg)
public KetamaNodeLocator(List<MemcachedNode> nodes, HashAlgorithm alg, KetamaNodeLocatorConfiguration conf)
Method Detail |
---|
public Collection<MemcachedNode> getAll()
NodeLocator
getAll
in interface NodeLocator
public MemcachedNode getPrimary(String k)
NodeLocator
getPrimary
in interface NodeLocator
k
- the object key
public Iterator<MemcachedNode> getSequence(String k)
NodeLocator
getSequence
in interface NodeLocator
k
- the object key
public NodeLocator getReadonlyCopy()
NodeLocator
getReadonlyCopy
in interface NodeLocator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |