Package net.spy.memcached.util
Class DefaultKetamaNodeLocatorConfiguration
java.lang.Object
net.spy.memcached.util.DefaultKetamaNodeLocatorConfiguration
- All Implemented Interfaces:
KetamaNodeLocatorConfiguration
public class DefaultKetamaNodeLocatorConfiguration
extends Object
implements KetamaNodeLocatorConfiguration
A Default implementation of the configuration required for the
KetamaNodeLocator algorithm to run.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a KetamaNodeLocatorConfiguraiton with the default SPYMEMCACHED node key formatDefaultKetamaNodeLocatorConfiguration
(KetamaNodeKeyFormatter nodeKeyFormatter) Create a KetamaNodeLocatorConfiguraiton -
Method Summary
Modifier and TypeMethodDescriptiongetKeyForNode
(MemcachedNode node, int repetition) Delegates to the KetamaNodeKeyFormatterint
Returns the number of discrete hashes that should be defined for each node in the continuum.
-
Field Details
-
numReps
private final int numReps- See Also:
-
ketamaNodeKeyFormatter
-
-
Constructor Details
-
DefaultKetamaNodeLocatorConfiguration
public DefaultKetamaNodeLocatorConfiguration()Create a KetamaNodeLocatorConfiguraiton with the default SPYMEMCACHED node key format -
DefaultKetamaNodeLocatorConfiguration
Create a KetamaNodeLocatorConfiguraiton- Parameters:
nodeKeyFormatter
- Ketama node key format, either SPYMEMCACHED or LIBMEMCACHED
-
-
Method Details
-
getNodeRepetitions
public int getNodeRepetitions()Returns the number of discrete hashes that should be defined for each node in the continuum.- Specified by:
getNodeRepetitions
in interfaceKetamaNodeLocatorConfiguration
- Returns:
- NUM_REPS repetitions.
-
getKeyForNode
Delegates to the KetamaNodeKeyFormatter- Specified by:
getKeyForNode
in interfaceKetamaNodeLocatorConfiguration
- 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
-