Class KetamaMemcachedSessionLocator
java.lang.Object
net.rubyeye.xmemcached.impl.AbstractMemcachedSessionLocator
net.rubyeye.xmemcached.impl.KetamaMemcachedSessionLocator
- All Implemented Interfaces:
MemcachedSessionLocator
Consistent Hash Algorithm implementation,based on TreeMap.tailMap(hash) method.
- Author:
- dennis
-
Field Summary
Fields inherited from class AbstractMemcachedSessionLocator
failureMode -
Constructor Summary
ConstructorsConstructorDescriptionCreate a KetamaMemcachedSessionLocator with default config.KetamaMemcachedSessionLocator(boolean cwNginxUpstreamConsistent) Create a KetamaMemcachedSessionLocatorKetamaMemcachedSessionLocator(List<Session> list, HashAlgorithm alg) Create a KetamaMemcachedSessionLocator with a special hash algorithm.KetamaMemcachedSessionLocator(HashAlgorithm alg, boolean cwNginxUpstreamConsistent) KetamaMemcachedSessionLocator(HashAlgorithm alg, boolean cwNginxUpstreamConsistent, boolean gwhalinMemcachedJavaClientCompatibiltyConsistent) -
Method Summary
Modifier and TypeMethodDescriptionfinal SessiongetSessionByHash(long hash) final SessiongetSessionByKey(String key) Returns a session by special key.final longfinal voidupdateSessions(Collection<Session> list) Update sessions when session was added or removed.Methods inherited from class AbstractMemcachedSessionLocator
setFailureMode
-
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
Create a KetamaMemcachedSessionLocator with a special hash algorithm.- Parameters:
alg-
-
KetamaMemcachedSessionLocator
-
KetamaMemcachedSessionLocator
public KetamaMemcachedSessionLocator(HashAlgorithm alg, boolean cwNginxUpstreamConsistent, boolean gwhalinMemcachedJavaClientCompatibiltyConsistent) -
KetamaMemcachedSessionLocator
-
-
Method Details
-
getSessionByKey
Description copied from interface:MemcachedSessionLocatorReturns a session by special key.- Parameters:
key-- Returns:
-
getSessionByHash
-
nextHash
-
updateSessions
Description copied from interface:MemcachedSessionLocatorUpdate sessions when session was added or removed.- Parameters:
list- The newer sessions
-