Class KetamaMemcachedSessionLocator

java.lang.Object
net.rubyeye.xmemcached.impl.AbstractMemcachedSessionLocator
net.rubyeye.xmemcached.impl.KetamaMemcachedSessionLocator
All Implemented Interfaces:
MemcachedSessionLocator

public class KetamaMemcachedSessionLocator extends AbstractMemcachedSessionLocator
Consistent Hash Algorithm implementation,based on TreeMap.tailMap(hash) method.
  • Field Details

    • NUM_REPS

      static final int NUM_REPS
      See Also:
    • ketamaSessions

      private transient volatile TreeMap<Long,List<Session>> ketamaSessions
    • hashAlg

      private final HashAlgorithm hashAlg
    • maxTries

      private int maxTries
    • DEFAULT_PORT

      static final int DEFAULT_PORT
      compatible with nginx-upstream-consistent,patched by wolfg1969
      See Also:
    • cwNginxUpstreamConsistent

      private final boolean cwNginxUpstreamConsistent
    • gwhalinMemcachedJavaClientCompatibiltyConsistent

      private final boolean gwhalinMemcachedJavaClientCompatibiltyConsistent
  • Constructor Details

    • KetamaMemcachedSessionLocator

      public KetamaMemcachedSessionLocator()
      Create a KetamaMemcachedSessionLocator with default config.
    • KetamaMemcachedSessionLocator

      public KetamaMemcachedSessionLocator(boolean cwNginxUpstreamConsistent)
      Create a KetamaMemcachedSessionLocator
      Parameters:
      cwNginxUpstreamConsistent - true if compatible with nginx up stream memcached consistent algorithm.
    • KetamaMemcachedSessionLocator

      public KetamaMemcachedSessionLocator(HashAlgorithm alg)
      Create a KetamaMemcachedSessionLocator with a special hash algorithm.
      Parameters:
      alg -
    • KetamaMemcachedSessionLocator

      public KetamaMemcachedSessionLocator(HashAlgorithm alg, boolean cwNginxUpstreamConsistent)
    • KetamaMemcachedSessionLocator

      public KetamaMemcachedSessionLocator(HashAlgorithm alg, boolean cwNginxUpstreamConsistent, boolean gwhalinMemcachedJavaClientCompatibiltyConsistent)
    • KetamaMemcachedSessionLocator

      public KetamaMemcachedSessionLocator(List<Session> list, HashAlgorithm alg)
  • Method Details