Interface QSessionStoreProviderInterface


public interface QSessionStoreProviderInterface
Interface for session storage providers. QBits or application code can implement this interface to provide session persistence. Implementations register themselves with QSessionStoreRegistry on startup, and QQQ core uses the registered provider for session caching. Example providers: - InMemory: ConcurrentHashMap for dev/testing - TableBased: QQQ table storage for multi-instance persistence - Redis: Distributed caching for HA deployments
  • Method Details

    • store

      void store(String sessionUuid, QSession session, Duration ttl)
      Store a session with the given TTL.
      Parameters:
      sessionUuid - Unique identifier for the session
      session - The session to store
      ttl - Time-to-live for the session
    • load

      Optional<QSession> load(String sessionUuid)
      Load a session by UUID.
      Parameters:
      sessionUuid - Unique identifier for the session
      Returns:
      Optional containing the session if found and not expired
    • remove

      void remove(String sessionUuid)
      Remove a session by UUID.
      Parameters:
      sessionUuid - Unique identifier for the session to remove
    • touch

      void touch(String sessionUuid)
      Touch a session to reset its TTL (sliding expiration).
      Parameters:
      sessionUuid - Unique identifier for the session to touch
    • getDefaultTtl

      Duration getDefaultTtl()
      Get the default TTL for sessions.
      Returns:
      The default time-to-live duration
    • loadAndTouch

      default Optional<QSession> loadAndTouch(String sessionUuid)
      Load a session and touch it to reset its TTL in a single operation. Default implementation calls load() then touch(). Providers may override with optimized implementations (e.g., Redis GETEX, combined SQL query).
      Parameters:
      sessionUuid - Unique identifier for the session
      Returns:
      Optional containing the session if found and not expired