Package net.spy.memcached
Class KetamaNodeKeyFormatter
- java.lang.Object
-
- net.spy.memcached.KetamaNodeKeyFormatter
-
public class KetamaNodeKeyFormatter extends java.lang.Object
Known key formats used in Ketama for assigning nodes around the ring
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KetamaNodeKeyFormatter.Format
-
Field Summary
Fields Modifier and Type Field Description private KetamaNodeKeyFormatter.Format
format
private java.util.Map<MemcachedNode,java.lang.String>
nodeKeys
-
Constructor Summary
Constructors Constructor Description KetamaNodeKeyFormatter()
KetamaNodeKeyFormatter(KetamaNodeKeyFormatter.Format format)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KetamaNodeKeyFormatter.Format
getFormat()
java.lang.String
getKeyForNode(MemcachedNode node, int repetition)
Returns a uniquely identifying key, suitable for hashing by the KetamaNodeLocator algorithm.
-
-
-
Field Detail
-
format
private final KetamaNodeKeyFormatter.Format format
-
nodeKeys
private java.util.Map<MemcachedNode,java.lang.String> nodeKeys
-
-
Constructor Detail
-
KetamaNodeKeyFormatter
public KetamaNodeKeyFormatter()
-
KetamaNodeKeyFormatter
public KetamaNodeKeyFormatter(KetamaNodeKeyFormatter.Format format)
-
-
Method Detail
-
getFormat
public KetamaNodeKeyFormatter.Format getFormat()
-
getKeyForNode
public java.lang.String getKeyForNode(MemcachedNode node, int repetition)
Returns a uniquely identifying key, suitable for hashing by the KetamaNodeLocator algorithm.- Parameters:
node
- The MemcachedNode to use to form the unique identifierrepetition
- The repetition number for the particular node in question (0 is the first repetition)- Returns:
- The key that represents the specific repetition of the node
-
-