Class SessionStore

    • Field Detail

      • __TYPE_ARG

        public static final io.vertx.lang.rx.TypeArg<SessionStore> __TYPE_ARG
      • DEFAULT_SESSIONID_LENGTH

        public static final int DEFAULT_SESSIONID_LENGTH
        Default length for a session id. More info: https://www.owasp.org/index.php/Session_Management_Cheat_Sheet
        See Also:
        Constant Field Values
    • Constructor Detail

      • SessionStore

        public SessionStore​(SessionStore delegate)
      • SessionStore

        public SessionStore​(Object delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • create

        public static SessionStore create​(Vertx vertx)
        Create a Session store given a backend and configuration JSON.
        Parameters:
        vertx - vertx instance
        Returns:
        the store or runtime exception
      • create

        public static SessionStore create​(Vertx vertx,
                                          JsonObject options)
        Create a Session store given a backend and configuration JSON.
        Parameters:
        vertx - vertx instance
        options - extra options for initialization
        Returns:
        the store or runtime exception
      • init

        public SessionStore init​(Vertx vertx,
                                 JsonObject options)
        Initialize this store.
        Parameters:
        vertx - the vertx instance
        options - optional Json with extra configuration options
        Returns:
        self
      • retryTimeout

        public long retryTimeout()
        The retry timeout value in milli seconds used by the session handler when it retrieves a value from the store.

        A non positive value means there is no retry at all.

        Returns:
        the timeout value, in ms
      • createSession

        public Session createSession​(long timeout)
        Create a new session using the default min length.
        Parameters:
        timeout - - the session timeout, in ms
        Returns:
        the session
      • createSession

        public Session createSession​(long timeout,
                                     int length)
        Create a new session.
        Parameters:
        timeout - - the session timeout, in ms
        length - - the required length for the session id
        Returns:
        the session
      • get

        public Maybe<Session> get​(String cookieValue)
        Get the session with the specified ID.
        Parameters:
        cookieValue - the unique ID of the session
        Returns:
        future that will be called with a result holding the session, or a failure
      • rxGet

        public Maybe<Session> rxGet​(String cookieValue)
        Get the session with the specified ID.
        Parameters:
        cookieValue - the unique ID of the session
        Returns:
        future that will be called with a result holding the session, or a failure
      • delete

        public Completable delete​(String id)
        Delete the session with the specified ID.
        Parameters:
        id - the session id
        Returns:
        future that will be called with a result, or a failure
      • rxDelete

        public Completable rxDelete​(String id)
        Delete the session with the specified ID.
        Parameters:
        id - the session id
        Returns:
        future that will be called with a result, or a failure
      • put

        public Completable put​(Session session)
        Add a session with the specified ID.
        Parameters:
        session - the session
        Returns:
        future that will be called with a result, or a failure
      • rxPut

        public Completable rxPut​(Session session)
        Add a session with the specified ID.
        Parameters:
        session - the session
        Returns:
        future that will be called with a result, or a failure
      • clear

        public Completable clear()
        Remove all sessions from the store.
        Returns:
        future that will be called with a result, or a failure
      • rxClear

        public Completable rxClear()
        Remove all sessions from the store.
        Returns:
        future that will be called with a result, or a failure
      • size

        public Single<Integer> size()
        Get the number of sessions in the store.

        Beware of the result which is just an estimate, in particular with distributed session stores.

        Returns:
        future that will be called with a result, or a failure
      • rxSize

        public Single<Integer> rxSize()
        Get the number of sessions in the store.

        Beware of the result which is just an estimate, in particular with distributed session stores.

        Returns:
        future that will be called with a result, or a failure
      • close

        public void close()
        Close the store