Class ClusterLettuceSessionStore

  • All Implemented Interfaces:
    Component, SessionStore

    public class ClusterLettuceSessionStore
    extends AbstractLettuceSessionStore<io.lettuce.core.cluster.api.StatefulRedisClusterConnection<java.lang.String,​SessionData>>
    A Redis-based session store using Lettuce as the client.

    Created: 2019/12/06

    Since:
    6.6.0
    • Constructor Detail

      • ClusterLettuceSessionStore

        public ClusterLettuceSessionStore​(ConnectionPool<io.lettuce.core.cluster.api.StatefulRedisClusterConnection<java.lang.String,​SessionData>> pool)
    • Method Detail

      • load

        public SessionData load​(java.lang.String id)
                         throws java.lang.Exception
        Description copied from interface: SessionStore
        Read in session data.
        Parameters:
        id - identity of session to load
        Returns:
        the SessionData matching the id
        Throws:
        java.lang.Exception - if unable to load session data
      • delete

        public boolean delete​(java.lang.String id)
                       throws java.lang.Exception
        Description copied from interface: SessionStore
        Delete session data.
        Parameters:
        id - identity of session to delete
        Returns:
        true if the session was deleted
        Throws:
        java.lang.Exception - if unable to delete session data
      • exists

        public boolean exists​(java.lang.String id)
                       throws java.lang.Exception
        Description copied from interface: SessionStore
        Test if data exists for a given session id.
        Parameters:
        id - Identity of session whose existence should be checked
        Returns:
        true if valid, non-expired session exists
        Throws:
        java.lang.Exception - if there is a problem checking the existence with persistence layer
      • doSave

        public void doSave​(java.lang.String id,
                           SessionData data,
                           long lastSaveTime)
                    throws java.lang.Exception
        Description copied from class: AbstractSessionStore
        Store the session data persistently.
        Specified by:
        doSave in class AbstractSessionStore
        Parameters:
        id - identity of session to store
        data - info of the session
        lastSaveTime - time of previous save or 0 if never saved
        Throws:
        java.lang.Exception - if unable to store data