Class SessionStore

java.lang.Object
io.vertx.mutiny.ext.web.sstore.SessionStore
All Implemented Interfaces:
MutinyDelegate
Direct Known Subclasses:
ClusteredSessionStore, LocalSessionStore

public class SessionStore extends Object implements MutinyDelegate
A session store is used to store sessions for an Vert.x-Web web app

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

Author:
Tim Fox, Paulo Lopes
See Also:
  • SessionStore
  • Field Details

    • 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:
    • __TYPE_ARG

      public static final TypeArg<SessionStore> __TYPE_ARG
  • Constructor Details

    • SessionStore

      public SessionStore(io.vertx.ext.web.sstore.SessionStore delegate)
      Create a new instance of SessionStore delegating to the given (non-null) instance of SessionStore.
    • SessionStore

      public SessionStore(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.ext.web.sstore.SessionStore getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • get

      @CheckReturnValue public io.smallrye.mutiny.Uni<Session> get(String cookieValue)
      Get the session with the specified ID.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      cookieValue - the unique ID of the session
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • SessionStore.get(String)
    • getAndAwait

      public Session getAndAwait(String cookieValue)
      Get the session with the specified ID.

      Unlike the bare Vert.x variant, this method returns a Session. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      cookieValue - the unique ID of the session
      Returns:
      The operation result
      See Also:
      • SessionStore.get(String)
    • getAndForget

      public SessionStore getAndForget(String cookieValue)
      Get the session with the specified ID.

      Unlike the bare Vert.x variant, this method ignores the Session result or any failure.

      Parameters:
      cookieValue - the unique ID of the session
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SessionStore.get(String)
    • delete

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> delete(String id)
      Delete the session with the specified ID.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      id - the session id
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • SessionStore.delete(String)
    • deleteAndAwait

      public void deleteAndAwait(String id)
      Delete the session with the specified ID.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      id - the session id
      See Also:
      • SessionStore.delete(String)
    • deleteAndForget

      public SessionStore deleteAndForget(String id)
      Delete the session with the specified ID.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Parameters:
      id - the session id
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SessionStore.delete(String)
    • put

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> put(Session session)
      Add a session with the specified ID.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      session - the session
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • io.vertx.ext.web.sstore.SessionStore#put(Session)
    • putAndAwait

      public void putAndAwait(Session session)
      Add a session with the specified ID.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      session - the session
      See Also:
      • io.vertx.ext.web.sstore.SessionStore#put(Session)
    • putAndForget

      public SessionStore putAndForget(Session session)
      Add a session with the specified ID.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Parameters:
      session - the session
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • io.vertx.ext.web.sstore.SessionStore#put(Session)
    • clear

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> clear()
      Remove all sessions from the store.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • SessionStore.clear()
    • clearAndAwait

      public void clearAndAwait()
      Remove all sessions from the store.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      See Also:
      • SessionStore.clear()
    • clearAndForget

      public SessionStore clearAndForget()
      Remove all sessions from the store.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SessionStore.clear()
    • size

      @CheckReturnValue public io.smallrye.mutiny.Uni<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.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • SessionStore.size()
    • sizeAndAwait

      public Integer sizeAndAwait()
      Get the number of sessions in the store.

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

      Unlike the bare Vert.x variant, this method returns a Integer. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Returns:
      The operation result
      See Also:
      • SessionStore.size()
    • sizeAndForget

      public SessionStore sizeAndForget()
      Get the number of sessions in the store.

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

      Unlike the bare Vert.x variant, this method ignores the Integer result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SessionStore.size()
    • 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, io.vertx.core.json.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, io.vertx.core.json.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
    • close

      public void close()
      Close the store
    • newInstance

      public static SessionStore newInstance(io.vertx.ext.web.sstore.SessionStore delegate)
      Creates a new instance of the SessionStore.
    • hashCode

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object