Class QSessionStoreHelper

java.lang.Object
com.kingsrook.qqq.backend.core.modules.authentication.QSessionStoreHelper

public class QSessionStoreHelper extends Object
Helper class for interacting with the session store. Delegates to the provider registered with QSessionStoreRegistry. All methods are designed to fail silently (returning empty/default values) when no provider is registered, ensuring backwards compatibility.
  • Constructor Details

    • QSessionStoreHelper

      public QSessionStoreHelper()
  • Method Details

    • isSessionStoreAvailable

      public static boolean isSessionStoreAvailable()
      Check if a session store provider is available.
    • storeSession

      public static void storeSession(String sessionUuid, QSession session, Duration ttl)
      Store a session in the session store (if available).
    • loadSession

      public static Optional<QSession> loadSession(String sessionUuid)
      Load a session from the session store (if available).
    • loadAndTouchSession

      public static Optional<QSession> loadAndTouchSession(String sessionUuid)
      Load a session and touch it to reset its TTL in a single operation. This is more efficient than calling loadSession + touchSession separately, as providers may implement optimized single-call versions (e.g., Redis GETEX, combined SQL query).
    • touchSession

      public static void touchSession(String sessionUuid)
      Touch a session to reset its TTL (if available).
    • getDefaultTtl

      public static Duration getDefaultTtl()
      Get the configured default TTL from the session store provider.