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.
  • Field Details

    • DEFAULT_HOST

      public static final String DEFAULT_HOST
      See Also:
    • DEFAULT_PORT

      public static final String 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

      protected SessionContext _context
  • Constructor Details

    • MemcachedSessionDataMap

      public MemcachedSessionDataMap(String host, String port)
      Parameters:
      host - address of memcache server
      port - address of memcache server
    • MemcachedSessionDataMap

      public MemcachedSessionDataMap(List<InetSocketAddress> addresses)
    • MemcachedSessionDataMap

      public MemcachedSessionDataMap(List<InetSocketAddress> addresses, int[] weights)
  • 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

      @ManagedAttribute(value="memcached expiry time in sec", readonly=true) public int getExpirySec()
      Expiry time for memached entries.
      Returns:
      memcached expiry time in sec
    • isHeartbeats

      @ManagedAttribute(value="enable memcached heartbeats", readonly=true) public boolean isHeartbeats()
    • setHeartbeats

      public void setHeartbeats(boolean heartbeats)
    • initialize

      public void initialize(SessionContext context)
      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 interface SessionDataMap
      Parameters:
      context - context associated
    • load

      public SessionData load(String id) throws Exception
      Description copied from interface: SessionDataMap
      Read in session data.
      Specified by:
      load in interface SessionDataMap
      Parameters:
      id - identity of session to load
      Returns:
      the SessionData matching the id
      Throws:
      Exception - if unable to load session data
    • store

      public void store(String id, SessionData data) throws Exception
      Description copied from interface: SessionDataMap
      Store the session data.
      Specified by:
      store in interface SessionDataMap
      Parameters:
      id - identity of session to store
      data - info of session to store
      Throws:
      Exception - if unable to write session data
    • delete

      public boolean delete(String id) throws Exception
      Description copied from interface: SessionDataMap
      Delete session data
      Specified by:
      delete in interface SessionDataMap
      Parameters:
      id - identity of session to delete
      Returns:
      true if the session was deleted
      Throws:
      Exception - if unable to delete session data
    • doStop

      protected void doStop() throws Exception
      Description copied from class: AbstractLifeCycle
      Method to override to stop the lifecycle
      Overrides:
      doStop in class AbstractLifeCycle
      Throws:
      Exception - If there was a problem stopping. Will cause a transition to FAILED state