Package net.rubyeye.xmemcached.impl
Class PHPMemcacheSessionLocator
- java.lang.Object
-
- net.rubyeye.xmemcached.impl.AbstractMemcachedSessionLocator
-
- net.rubyeye.xmemcached.impl.PHPMemcacheSessionLocator
-
- All Implemented Interfaces:
MemcachedSessionLocator
public class PHPMemcacheSessionLocator extends AbstractMemcachedSessionLocator
Session locator base on hash(key) mod sessions.size(). Uses the PHP memcached hash strategy so it's easier to share data with PHP based clients.
-
-
Field Summary
Fields Modifier and Type Field Description private HashAlgorithmhashAlgorithmprivate java.util.List<Session>sessions-
Fields inherited from class net.rubyeye.xmemcached.impl.AbstractMemcachedSessionLocator
failureMode
-
-
Constructor Summary
Constructors Constructor Description PHPMemcacheSessionLocator()PHPMemcacheSessionLocator(HashAlgorithm hashAlgorithm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetHash(int size, java.lang.String key)longgetNext(int size, long start)SessiongetSessionByKey(java.lang.String key)Returns a session by special key.voidsetHashAlgorighm(HashAlgorithm hashAlgorithm)voidupdateSessions(java.util.Collection<Session> list)Update sessions when session was added or removed.-
Methods inherited from class net.rubyeye.xmemcached.impl.AbstractMemcachedSessionLocator
setFailureMode
-
-
-
-
Field Detail
-
hashAlgorithm
private HashAlgorithm hashAlgorithm
-
sessions
private transient volatile java.util.List<Session> sessions
-
-
Constructor Detail
-
PHPMemcacheSessionLocator
public PHPMemcacheSessionLocator()
-
PHPMemcacheSessionLocator
public PHPMemcacheSessionLocator(HashAlgorithm hashAlgorithm)
-
-
Method Detail
-
setHashAlgorighm
public final void setHashAlgorighm(HashAlgorithm hashAlgorithm)
-
getHash
public final long getHash(int size, java.lang.String key)
-
getSessionByKey
public final Session getSessionByKey(java.lang.String key)
Description copied from interface:MemcachedSessionLocatorReturns a session by special key.- Returns:
-
getNext
public final long getNext(int size, long start)
-
updateSessions
public final void updateSessions(java.util.Collection<Session> list)
Description copied from interface:MemcachedSessionLocatorUpdate sessions when session was added or removed.- Parameters:
list- The newer sessions
-
-