Interface SessionStore<S>

Type Parameters:
S - the type of the custom session state
All Known Implementing Classes:
InMemorySessionStore

public interface SessionStore<S>
SessionStore is an interface for persisting session data.

Implementations can provide different storage backends such as:

  • In-memory storage (for development/testing)
  • Database storage (for production)
  • Redis or other distributed cache
  • File-based storage
  • Method Details

    • get

      Retrieves a session by its ID.
      Parameters:
      sessionId - the session ID
      Returns:
      a CompletableFuture containing the session data, or null if not found
    • save

      CompletableFuture<Void> save(String sessionId, SessionData<S> data)
      Saves session data.
      Parameters:
      sessionId - the session ID
      data - the session data to save
      Returns:
      a CompletableFuture that completes when the save is done
    • delete

      default CompletableFuture<Void> delete(String sessionId)
      Deletes a session by its ID.
      Parameters:
      sessionId - the session ID
      Returns:
      a CompletableFuture that completes when the deletion is done
    • exists

      default CompletableFuture<Boolean> exists(String sessionId)
      Checks if a session exists.
      Parameters:
      sessionId - the session ID
      Returns:
      a CompletableFuture containing true if the session exists