Interface SessionDriver

All Known Implementing Classes:
FileSessionDriver

public interface SessionDriver
Interface representing a driver responsible for session persistence operations.
Since:
3.3.5-SNAPSHOT
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    destroy(Session session, String sessionID)
    Destroys or removes the session data associated with the given session identifier from the underlying storage.
    boolean
    exists(Session session, String sessionID)
    Checks if the session id exists in the underlying storage.
    void
    load(Session session, String sessionID)
    Loads session data from the underlying storage into the provided session instance.
    default void
    migrate(Session session, String sessionID, SessionDriver priorDriver)
    Migrates the session data from one SessionDriver to another.
    void
    save(Session session, String sessionID)
    Persists the provided session data to the underlying storage.
  • Method Details

    • exists

      boolean exists(Session session, String sessionID) throws IOException
      Checks if the session id exists in the underlying storage.
      Parameters:
      session - The Session instance to be populated with data.
      sessionID - The unique identifier of the session.
      Returns:
      Returns true if the session exists in the underlying storage, false otherwise.
      Throws:
      IOException - If an error occurs while loading the session data.
      Since:
      3.4.0-SNAPSHOT
    • load

      void load(Session session, String sessionID) throws IOException
      Loads session data from the underlying storage into the provided session instance.
      Parameters:
      session - The Session instance to be populated with data.
      sessionID - The unique identifier of the session.
      Throws:
      IOException - If an error occurs while loading the session data.
    • save

      void save(Session session, String sessionID) throws IOException
      Persists the provided session data to the underlying storage.
      Parameters:
      session - The session instance containing data to be saved.
      sessionID - The unique identifier of the session.
      Throws:
      IOException - If an error occurs while saving the session data.
    • destroy

      void destroy(Session session, String sessionID) throws IOException
      Destroys or removes the session data associated with the given session identifier from the underlying storage.

      NOTE: Should not clear the underlying session object, otherwise the migrate function will no longer work.

      Parameters:
      session - The session instance to be destroyed.
      sessionID - The unique identifier of the session.
      Throws:
      IOException - If an error occurs while destroying the session data.
    • migrate

      default void migrate(Session session, String sessionID, SessionDriver priorDriver) throws IOException
      Migrates the session data from one SessionDriver to another.
      Parameters:
      session - The session instance to be migrated.
      sessionID - The unique identifier of the session.
      priorDriver - The prior SessionDriver from which this session is migrated.
      Throws:
      IOException - If an error occurs while migrating the session data.
      Since:
      3.3.5-SNAPSHOT