Class MemcachedSessionDataMap
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.memcached.session.MemcachedSessionDataMap
- All Implemented Interfaces:
SessionDataMap
,LifeCycle
@ManagedObject
public class MemcachedSessionDataMap
extends AbstractLifeCycle
implements SessionDataMap
MemcachedSessionDataMap
Uses memcached as a cache for SessionData.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
SessionDataTranscoder We override memcached deserialization to use our classloader-aware ObjectInputStream.Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopException
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Field Summary
Modifier and TypeFieldDescriptionprotected net.rubyeye.xmemcached.XMemcachedClientBuilder
protected net.rubyeye.xmemcached.MemcachedClient
protected SessionContext
protected int
protected boolean
static final String
static final String
-
Constructor Summary
ConstructorDescriptionMemcachedSessionDataMap
(String host, String port) MemcachedSessionDataMap
(List<InetSocketAddress> addresses) MemcachedSessionDataMap
(List<InetSocketAddress> addresses, int[] weights) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Delete session dataprotected void
doStop()
Method to override to stop the lifecyclenet.rubyeye.xmemcached.XMemcachedClientBuilder
int
Expiry time for memached entries.void
initialize
(SessionContext context) Initialize this data map for the given context.boolean
Read in session data.void
setExpirySec
(int sec) void
setHeartbeats
(boolean heartbeats) void
store
(String id, SessionData data) Store the session data.Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addEventListener, doStart, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stop, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stop
-
Field Details
-
DEFAULT_HOST
- See Also:
-
DEFAULT_PORT
- See Also:
-
_client
protected net.rubyeye.xmemcached.MemcachedClient _client -
_expirySec
protected int _expirySec -
_heartbeats
protected boolean _heartbeats -
_builder
protected net.rubyeye.xmemcached.XMemcachedClientBuilder _builder -
_context
-
-
Constructor Details
-
MemcachedSessionDataMap
- Parameters:
host
- address of memcache serverport
- address of memcache server
-
MemcachedSessionDataMap
-
MemcachedSessionDataMap
-
-
Method Details
-
getBuilder
public net.rubyeye.xmemcached.XMemcachedClientBuilder getBuilder()- Returns:
- the builder
-
setExpirySec
public void setExpirySec(int sec) - Parameters:
sec
- the expiry to use in seconds
-
getExpirySec
Expiry time for memached entries.- Returns:
- memcached expiry time in sec
-
isHeartbeats
-
setHeartbeats
public void setHeartbeats(boolean heartbeats) -
initialize
Description copied from interface:SessionDataMap
Initialize this data map for the given context. A SessionDataMap can only be used by one context(/session manager).- Specified by:
initialize
in interfaceSessionDataMap
- Parameters:
context
- context associated
-
load
Description copied from interface:SessionDataMap
Read in session data.- Specified by:
load
in interfaceSessionDataMap
- Parameters:
id
- identity of session to load- Returns:
- the SessionData matching the id
- Throws:
Exception
- if unable to load session data
-
store
Description copied from interface:SessionDataMap
Store the session data.- Specified by:
store
in interfaceSessionDataMap
- Parameters:
id
- identity of session to storedata
- info of session to store- Throws:
Exception
- if unable to write session data
-
delete
Description copied from interface:SessionDataMap
Delete session data- Specified by:
delete
in interfaceSessionDataMap
- Parameters:
id
- identity of session to delete- Returns:
- true if the session was deleted
- Throws:
Exception
- if unable to delete session data
-
doStop
Description copied from class:AbstractLifeCycle
Method to override to stop the lifecycle- Overrides:
doStop
in classAbstractLifeCycle
- Throws:
Exception
- If there was a problem stopping. Will cause a transition to FAILED state
-