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 Details

  • Constructor Details

    • DefaultKetamaNodeLocatorConfiguration

      public DefaultKetamaNodeLocatorConfiguration()
      Create a KetamaNodeLocatorConfiguraiton with the default SPYMEMCACHED node key format
    • DefaultKetamaNodeLocatorConfiguration

      public DefaultKetamaNodeLocatorConfiguration(KetamaNodeKeyFormatter nodeKeyFormatter)
      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 interface KetamaNodeLocatorConfiguration
      Returns:
      NUM_REPS repetitions.
    • getKeyForNode

      public String getKeyForNode(MemcachedNode node, int repetition)
      Delegates to the KetamaNodeKeyFormatter
      Specified by:
      getKeyForNode in interface KetamaNodeLocatorConfiguration
      Parameters:
      node - The MemcachedNode to use to form the unique identifier
      repetition - 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