Class HeapSessionStore<T extends Session>

java.lang.Object
is.galia.resource.HeapSessionStore<T>

public final class HeapSessionStore<T extends Session> extends Object
Thread-safe session store using the Java heap.
  • Constructor Details

    • HeapSessionStore

      public HeapSessionStore(Duration sessionDuration)
  • Method Details

    • evictExpired

      public void evictExpired()
    • get

      public Optional<T> get(String id)
      Returns the valid session in the store with the given ID. If such a session does not exist in the store, an empty value is returned. If an invalid session exists, it is removed from the store and an empty value is returned.
      Parameters:
      id - Session ID.
      Returns:
      Session in the store with the given ID, if it exists and is valid.
    • put

      public void put(T session)
      Adds the given instance to the store. If it is expired, it is silently discarded instead of being added.
      Parameters:
      session - Session to add to the store.