Class DefaultKetamaNodeLocatorConfiguration

    • Constructor Detail

      • 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 Detail

      • 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 java.lang.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